Chapter 17. Abstract Factory

There will be times when you want to provide for object creation while retaining control of which class to instantiate. In such circumstances, you can apply the FACTORY METHOD pattern with a method that uses an outside factor to determine which class to instantiate. Sometimes the factor that controls which object to instantiate can be thematic, running across several classes. The ABSTRACT FACTORY pattern addresses this situation. Its intent is to provide for the creation of families of related or dependent objects.

A Classic Example—GUI Kits

GUI kits provide a classic example of the ABSTRACT FACTORY pattern. A GUI kit is an object that is an abstract factory, supplying GUI controls to a client that is building a user ...

Get Design Patterns in C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.