Intent

Decouple an abstraction from its implementation so that the two can vary independently. Also known as Handle/Body.

Where to use & benefits

Structure


Participants

Abstraction   (MainApplet)
It defines the abstraction's interface and maintains a reference to an object of type Implementor.

RefinedAbstraction
Extends the interface defined by Abstraction.

Implementor   (IAppletGUIBuilder)
defines the interface for implementation classes. This interface can be quite different to Abstraction's interface.

ConcreteImplementor  (ButtonBuilder, ListBuilder)
implements the Implementor interface and defines its concrete implementation.

Example

In the demonstration application, the bridge pattern is not implemented as a whole, but the MainApplet class act as the Abstraction to maintain the reference of different objects of its type implementor.

Source Code Links