Design Pattern - Abstract Factory

Definition:

Provide an interface for creating families of related or dependent objects without specifying their concrete classes

participants:

The classes and/or objects participating in this pattern are:

1) AbstractFactory  (ContinentFactory) - declares an interface for operations that create abstract products
2) ConcreteFactory   (AfricaFactory, AmericaFactory) -  implements the operations to create concrete product objects
3) AbstractProduct   (Herbivore, Carnivore) - declares an interface for a type of product object
4) Product  (Wildebeest, Lion, Bison, Wolf) - defines a product object to be created by the corresponding concrete factory implements the AbstractProduct interface
5) Client  (AnimalWorld) - uses interfaces declared by AbstractFactory and AbstractProduct classes

Ebook Download
View all
Learn
View all