Monthly Archives: April 2011

Singleton in multi-threaded environment

The code posted here should be considered as pseudo-code, no particular language is assumed. And also it is assumed that the reader is already familiar with the Singleton pattern, i.e. I am not going to discuss what is a Singleton, … Continue reading

Posted in Design Pattern | Tagged | 5 Comments

Encapsulate a family of algorithms using Strategy Pattern

The scenario Suppose we are writing a game where the world (or at least some part of it) is full of evil (sounds familiar?) and the goal of the player is to free the world from the grasp of evil. … Continue reading

Posted in Design Pattern | Tagged | Leave a comment