Archive for September, 2009
Decorator Pattern Added
What if you need to alter the functionality of a class method in some places without altering the original class? The Decorator pattern may be just what you’re looking for, and it comes with a bonus: you can chain object decorators together to add as many features as you need. As with other design patterns, [...]
Factory Pattern Added
The Factory pattern helps you create one of a number of interchangeable patterns in a way that is easy to maintain and extend. One ideal use of the factory pattern is in the concept of drivers. Take, for instance, an application that has the capability to connect to several different types of database engines (MySQL, [...]
In: Design Patterns
Singleton Pattern Added
Today’s design pattern is the Singleton pattern, which makes it impossible to have more than one instance of a class. Perhaps you have multiple places in your codebase that attempt to open a connection to the database. Without some controls, your code could open multiple connections to the same database. But with the Singleton pattern, [...]
In: Design Patterns
Welcome
Welcome to PHP Design Patterns. This site aims to provide information and tutorials for PHP developers looking to incorporate design patterns into their code. For more information, see our page What’s a Design Pattern?
