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, [...]

Posted on September 27, 2009 at 10:41 pm by Eric B · Permalink · One Comment
In: 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, [...]

Posted on September 23, 2009 at 11:25 pm by Eric B · Permalink · Leave a comment
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, [...]

Posted on September 22, 2009 at 12:01 am by Eric B · Permalink · Leave a comment
In: Design Patterns