News Feed
Sections




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

Label Media Blog:
Design Patterns in PHP - Factory method
November 26, 2010 @ 13:56:03

On the Label Media blog today there's a new post from Tom Rawcliffe (the first part of a series) about a common design pattern you can use in your applications - the factory pattern.

A design pattern is a template used by software engineers as a guideline of how to solve a particular problem. [...] In this series of articles I plan to explore some of the design patterns that i have found most useful in my time as a PHP developer, providing examples and notes. So, this being the first, we'll take a look at the Factory Method Pattern.

He defines the pattern - an interface to a class without the caller having to know what type of class it is - and a code example showing an abstract class with a "Factory" method that pulls information from either a jpeg or png class based on the extension of the file name given.

1 comment voice your opinion now!
factory method designpattern introduction series


blog comments powered by Disqus

Similar Posts

Hafiz Waheeduddin Ahmad: API Testing: Installing and Using Codeception

Devshed: The Basics of Using the Prototype Pattern with PHP 5

NetTuts.com: Refactoring Legacy Code: Part 1 - The Golden Master

David Makin: Creating a simple REST application with Silex part 2

Paul Jones: Refactoring To Action-Domain-Responder


Community Events

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


api podcast series introduction php7 composer testing laravel interview list yii2 community opinion project language part2 application framework example symfony

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