7 Answers
7

A class implementing factory design pattern works as bridge between multiple classes. Consider an example of using multiple database servers like SQL Server and Oracle. If you are developing an application using SQL Server database as backend, but in future need to change backend database to oracle, you will need to modify all your code, if you haven’t written your code following factory design pattern.

In factory design pattern you need to do very little work to achieve this. A class implementing factory design pattern takes care for you and lessen your burden. Switching from database server won’t bother you at all. You just need to make some small changes in your configuration file.

Other examples of factory methods: Zend_Cache::factory(), Zend_Memory::factory(). Zend_Log_Writer also has factory methods for initializing concrete adapters of Zend_Log_Writer_Abstract. One thing has to be noted though: those implementations are generally in form when factory method is injected directly into product (that's there is no separate AbstractCreator/ConcreteCreator classes).
–
Victor FarazdagiNov 7 '10 at 14:09

Just re-checked the code: ZF actually utilizes what is called Simple Factory, which is idiom and not a pattern (described say in HF Design Patterns). I also saw bunch of static factory methods, at least implementation was very similar to what Bloch's discussed in Effective Java. And I couldn't locate exact GoF's implementation of Factory Method Pattern.
–
Victor FarazdagiNov 8 '10 at 1:41

Simple Factory Design Pattern doesn’t belong to the Gangs of Four. A Simple Factory Pattern is one of that returns an instance of one of several possible classes, depending on the data provided to it. This implies that the classes it returns have same parent class and methods, but each of them perform task differently for different kind of data.
Here is the complete post with real world example