I’ll be giving a “mini-talk” on the Factory Method pattern at Atlanta PHP this evening.
Who doesn’t love the Factory Method pattern, right? Good stuff. A link to a PDF of the slides is below. I struggled to come up with a cool example, but an one related to cars was the best that I could do. You’ll find some PHP-specific example code in the slides, too.
For further reading on the Factory Method pattern and other classic design patterns, you can always grab a copy of Design Patterns: Elements of Reusable Object-Oriented Software. Enjoy!