Category Archives: Design Pattern

The Abuse of Design Patterns in writing a Hello World Program

“One comment I saw in a news group just after patterns started to become more popular was someone claiming that in a particular program they tried to use all 23 GoF patterns. They said they had failed, because they were … Continue reading

Posted in Design Pattern | Tagged | 17 Comments

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

Implement a true Singleton in AS3

Singleton is a design pattern that enforces that a class can have only one instance which is shared by all and provides an easy global access point to this. A few examples are: In iOS the UIDevice class is a … Continue reading

Posted in AS3, Design Pattern | Tagged , | 6 Comments