Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Factory design pattern

2,094 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Factory design pattern

  1. 1. Factory Design Patterns Farhad Safarov
  2. 2. Real World Examples:• The Bank• The Library
  3. 3. Advantages:• creates objects without exposing the instantiation logic to the client $obj = new ClassA(new ClassB, new Class C);• It is possible to use inheritance to easily edit how the class is created and put in a different set of classes
  4. 4. UML
  5. 5. PHP example:
  6. 6. Symfony2• Services• http://api.symfony.com/2.0/Symfony/Bundle/ SecurityBundle/DependencyInjection/Security /Factory/SecurityFactoryInterface.html
  7. 7. Abstract Factory
  8. 8. The End• Any questions?
  9. 9. References:• http://www.oodesign.com/factory-pattern.html• http://www.itec.uni-klu.ac.at/~harald/ds2001/rmi/factory/factory2.html• http://en.wikipedia.org/wiki/Factory_method_pattern

×