Archive for October, 2011

Design Pattern: Command in PHP


The next pattern from the Head First Design Patterns book is the Command Pattern. The command pattern allows decoupling of an action’s requester and the actual object that performs the action.

Design Pattern: Singleton in PHP

This is the third of my Head First Design Pattern post. This time, I am going to be porting the Singleton pattern from Java to PHP.

The Singleton pattern is used to create one of a kind object where there should only be a single instance. i.e. thread pools, logging, caching and etc. It also gives a global point of access to the rest of the application to access the instance.

Design Pattern: Observer in PHP

My second design pattern is the observer. As mentioned in the first design blog entry, the code comes from Head First Design Patterns.

Design Pattern: Strategy in PHP

As part of my ongoing self education, I decided to delve more into design patterns to fully appreciate the art of software design. My book of choice for this learning process was “Head First Design Patterns“. As the code samples were in Java, I decided to port the code to PHP so that others who are interested in the book, but are more familiar with PHP can see how it could be achieved with equal ease.

Categories