The Abstract Factory groups part creation for a family of...

1
1 1 The Abstract Factory groups part creation for a family of parts so the family can be changed. § Define an common interface for each family element that the application uses § Define a class that is responsible for creating all elements in the family via a factory method for each element § Application instantiates desired factory 2 MotifFactory getWindow() getButton() Win32Factory getWindow() getButton() Example: WidgetFactory WidgetFactory getWindow() getButton() MotifWindow Win32Window Window MotifButton Win32Button Button

Transcript of The Abstract Factory groups part creation for a family of...

1

1

The Abstract Factory groups part creation for a family of parts so the family can be changed.

§ Define an common interface for each family element that the application uses

§ Define a class that is responsible for creating all elements in the family via a factory method for each element

§ Application instantiates desired factory

2

MotifFactory

getWindow()getButton()

Win32Factory

getWindow()getButton()

Example: WidgetFactory

WidgetFactory

getWindow()getButton()

MotifWindowWin32Window

Window

MotifButtonWin32Button

Button