Design Patterns: Factories

Sign in to queue


This is the sixth of an eight part series where Robert is joined by Phil Japikse to discuss design patterns. A design pattern is a best practice you can use in your code to solve a common problem.  In this episode, Phil demonstrates the Simple Factory, Factory Method and Abstract Factory patterns. The Simple Factory pattern encapsulates object creation in one place. The Factory Method pattern uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes. 

Episodes in this series:




The Discussion

  • User profile image

    Great series, guys! When you were asking what pattern was being used in OrderPizza, I would also say that OrderPizza resembles the TemplateMethod pattern. And in GOF, FactoryMethod is mentioned as a pattern that is commonly used in TemplateMethod

  • User profile image

    Can you please share the code , which you have used for Demo ?

  • User profile image

    @Santosh: Click on the Sample Code link in the Resources list. That will take you to the code we used. 

Add Your 2 Cents