AbstractFactory Design Pattern with an Example program
Definition:
- Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
- A hierarchy that encapsulates: many possible “platforms”, and the construction of a suite of “products”.
- The new operator considered harmful.
Where to use & benefits
- Creates families of related or dependent objects like Kit.
- Provides a class library of products, exposing interface not implementation.
- Needs to isolate concrete classes from their super classes.
- A system needs independent of how its products are created, composed, and represented.
- Try to enforce a constraint.
- An alternative to Facade to hide platform-specific classe.
- Easily extensible to a system or a family.
- Related patterns include.