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, PostgreSQL, Oracle, etc.). If you encapsulate each driver into its own interchangeable class, your factory can produce one database driver instance on the fly, and the rest of your code can use that database class, not caring which database it is connected to or what the differences are between the database engines.

The Factory pattern is used extensively in PHP frameworks and other applications that aim to be easily configurable and extensible.

Posted on September 23, 2009 at 11:25 pm by Eric B · Permalink
In: Design Patterns

Leave a Reply

You must be logged in to post a comment.