Abstract Factory

Intent

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

      -Design Patterns, GoF

 

 

Structure

From dofactory.com:

 

 

Questions

1. How does the Abstract Factory pattern support the principle of implementing to an interface, not a class?

2. What are some typical product families that are encountered in an enterprise application?  How often are they exchanged?

3. If products are often added or removed, what is the impact, given this pattern?

4. Is there ever overlap between product families?  How could you support this, given the pattern?

5. What happens if one product family has a slightly different set of products?

 

Examples – Which are Abstract Factories?

1. Core J2EE Design Patterns – Abstract DAO Factory

 

 

References

·         Principles, Patterns, and Practices: The Factory Pattern, Robert C. Martin (Java.net, March 2005) Abstract Factory Design Pattern (DoFactory.com)