Archive for the ‘Design Patterns’ Category
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
