Intent

Separate the construction of a complex object from its representation so that the same construction process can create different representations.

Where to use & benefits

Structure


Participants

Builder  (IAppletGUIBuilder)
specifies an abstract interface for creating parts of a Product object.

ConcreteBuilder  (ButtonBuilder, ListBuilder)
constructs and assembles parts of the product by implementing the Builder interface.

Director  (MainApplet)
constructs an object using the Builder interface.

Product  (java.awt.Button, java.awt.List, java.awt.event.ActionListner)
represents the complex object under construction. ConcreteBuilder builds the product's internal representation and defines the process by which it's assembled.

Example

In the demonstration application, MainApplet class uses ButtonBuilder and ListBuilder classes to create and initialize the button and list components in the applet UI.

Class Diagram


Source Code Links