Showing posts from November, 2010

The Singleton pattern in C#

Singleton Pattern:Example One
Thread safe example
It is created at the beginning of the application and this makes it thread safe.
The static part of the instance is private and the public Singleton can be gotten using GetInstance() that returns an instance of this class hence making sure that only one instance of the object is created in the application current state for example a shopping cart on a webpage.
using System; /// /// Thread-safe singleton created at first call /// namespace Singleton { class Singleton { private static Singleton instance = new Singleton(); private Singleton(){} public static Singleton GetInstance() { return instance; } public double Total { get; set; } public string UserName { get; set; } } }
Here is how you make a call on the Singleton class :
Singleton single = Singleton.getInstance(); single.UserName = "Ngala" ; single.Total = 345.00 ;…

TekPub - Concepts

TekPub - Concepts
I love watching videos from Microsoft Mix . These videos are very enriching and one gets to know about current and future products of Microsoft .You get to see all these great videos(some of them) from the guys themselves that develop these products. I happen to have fallen on Rob Conery presentation on the MVC Store Front. Its just amazing and I really feel in love with the scripting aspect of his application. So I though to myself to see if this guy offers more. Luckily he had a website called Tekpub that publishes videos tutorials. The quality is really good. For now I am watching all his videos on key concepts in software. He demystifies them and I feel like I can start using all these knowledge the next time I want to build an application. The truth is interfaces are powerful in design of software and knowing how to use them makes you build really groundbreaking and flexible applications. Here are the key concepts he talks about and show us life code exampl…

A paddle and ball game in Javascript

As a web developer you just have to know and write some javascript to add some extra feeling and functionality on your web applications .I am not a declared web developer but since i love the web it will be nice to be able understand its own key programming language . Here is where I start .I am building a small paddle and ball game .I am not starting from the basics because I already understand the basics in programming. What I wish to accomplish is to be able to link css to javascript ,move objects on the screen and let it work on all browsers. I wanted to do it with jquery but I feel like I am cheating on myself on my goal to learn the main scripting language for the web. Just some raw Javascript will make me happy.I know i will learn events in javascript,functions definitions,timing,key game concepts and others as I develop the game.
To start the development of this game .They are certain important objects that have to be defined.Anyway lets imagine how the player will play the …