skip to Main Content


Say hello to the toggle bar. This is an optional section you can use to display any content you'd like. Simply select a page from the theme panel and the content of the page will display here. You can even use the drag and drop builder to create this! This is a perfect place for your company mission statement, alerts, notices or anything else.

Get In Touch

Phone: 1-800-Total-Theme
Address: Las Vegas, Nevada

Our Location


Abstract Factory

Post Series: Creational Design Pattern

Abstract factory pattern in useful when the client needs to create objects which are somehow related. If we need to create the family of related or dependent objects, then we can use Abstract Factory Pattern.


The client needs to create objects which are somehow related.


  • AbstractFactory:     declares an interface for operations that create abstract products
  • ConcreteFactory: implements the operations to create concrete product objects
  • AbstractProduct:     declares an interface for a type of product object
  • ConcreteProduct: defines a product object to be created by the corresponding concrete factory implements the AbstractProduct interface
  • Client: uses interfaces declared by AbstractFactory and AbstractProduct classes

which interface, which class


We need three concrete factories (one for each manufacturer) and two sets of related products (one for smart and one for dumb).

  1. Type of phone (concrete factories)
    • Nokia
    • Samsung
    • HTC
  2. Phone manufacturer (related product)
    • Smart Phones
    • Dumb Phones


Creating the Abstract Products

Creating Concrete Product

For Dumb Phone

For Smart Phone

Creating the Abstract Factory

Creating the Concrete Factories

Creating the Client




  • Create a set of related objects, or dependent objects which must be used together.
  • System should be configured to work with multiple families of products.
  • The creation of objects should be independent from the utilizing system.
  • Concrete classes should be decoupled from clients.





Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top