When an application creates several related objects, independently choosing each concrete object can mix incompatible families. The Abstract Factory Design Pattern supplies an interface for creating families of related or dependent objects without naming their concrete classes. section 9.2 section 9.3
The pattern separates family selection from object construction. An abstract factory declares creation operations; concrete factories implement those operations for one family. Clients use the appropriate factory instead of constructing family members directly. section 9.2.2
A typical structure contains:
- An abstract factory such as ProvisionsFactory, declaring operations such as make_players() and make_venue(). section 9.2.2
- Concrete factories such as VarsityFactory and IntramuralFactory, each producing objects from one consistent family. section 9.2.2
- Client classes such as VarsityDept and IntramuralDept, which select a factory but do not know how it creates players or venues. section 9.2.2
- Abstract product interfaces such as PlayerStrategy and VenueStrategy, with family-specific implementations behind them. section 9.2.3
Keeping athletic provisions consistent
VarsityFactory creates varsity player and venue objects, while IntramuralFactory creates intramural equivalents. VarsityDept passes a VarsityFactory to sports such as VarsityBaseball; IntramuralDept passes an IntramuralFactory. The resulting families remain together: varsity sports use varsity players and stadiums, while intramural sports use intramural players and open fields. section 9.2.2
Figure 9.4 This version of the application is modeled from the Abstract Factory Design Pattern. Interface ProvisionsFactory is the abstract factory. Implementor class VarsityFactory creates the varsity family of player and venue objects, and therefore, VarsityDept uses VarsityFactory. Implementor class IntramuralFactory creates the intramural family of player and venue objects, and therefore, IntramuralDept uses IntramuralFactory. The grayed-out portions of the diagram have not changed logically from figure 9.2.
Use the class diagram to trace the abstract factory, concrete factories, client departments, and related product families. section 9.2.2


