News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Understanding the Factory Method Design Pattern
December 16, 2011 @ 12:15:54

On PHPMaster.com today there's a new design pattern-focused that introduces you to using the Factory method to create new objects on the fly.

The Factory Method pattern is a design pattern used to define a runtime interface for creating an object. It's called a factory because it creates various types of objects without necessarily knowing what kind of object it creates or how to create it.

Code is included showing how to make creating "Product_*" classes as simple as calling a "build()" method with the type. A slightly more complex situation is also included - building factories inside of factory methods. For more about the Factory design pattern, check out its Wikipedia page (that includes some common uses and some pitfalls to watch out for).

0 comments voice your opinion now!
factory method designpattern tutorial introduction


blog comments powered by Disqus

Similar Posts

Chance Garcia's Blog: MAMP PRO, PECL, SSH2, and OSX CLI (AKA acronym madness)

Raphael Stolt's Blog: Phplocing your projects with Phing

SitePoint PHP Blog: Creating a Subscription-Based Website with Laravel and Recurly, Part 1

Aaron McGowan: Finally generators exist as of PHP 5.5

NETTUTS.com: Diving into PHP


Community Events











Don't see your event here?
Let us know!


performance opinion package symfony2 facebook overview introduction application component unittest install code framework language release composer hhvm podcast security hack

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework