28
A Sample Pattern Description
Abstract Factory
•Intent
• Provide an interface for creating families of related or
• dependent objects without specifying their concrete classes
•Motivation
•Consider a user interface toolkit that supports multiple look-and-feel standards such as Motif and Presentation Manager. To be portable across look-and-feel standards, an application should not hard-code its widgets (windows, scroll bars,...) for a particular look and feel.
•We can solve this problem by defining an abstract WidgetFactory class that declares the interfaces for creating each kind of widget. We also use abstract classes for each kind of widget with concrete subclasses to actually implement the various look-and-feel standards