Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Label Media Blog: Design Patterns in PHP – Factory method

Label Media Blog: Design Patterns in PHP – Factory method

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.

Source: http://www.phpdeveloper.org/news/15501

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Listopad 29th, 2010 in WEB and PHP Development.

Leave a response: