Design Patterns - Abstract Factory PDF download

The Abstract Factory Design Pattern "provide[s] an interface for creating families of related or dependent objects without specifying their concrete classes." Sounds complicated, but is easier to understand with an example:

The controls on a skinnable program can be either red or black. The Abstract Factory provides the right controls to the rest of the code like so:

C++:
  1. AbstractFactory controlSupplier = new AbstractFactory();
  2.  
  3. Button b = controlSupplier.getButton();

This means that the other classes in the code don't have to worry about the skinning of the controls, all they have to do is ask the Abstract Factory instance to provide the right kind of control and they get a fully skinned and customized control.