| Origin: |
GoF 95 |
| Reason: |
Allow (a hierarchy of) abstractions to vary independently
of (a hierarchy of) their implementations. E.g., select or
switch an abstraction's implementation at run-time
(a.k.a Handle/Body).
|
| Synopsis: |
Decouple an abstraction from its implementation so that the
two can vary independently [GoF].
|
| Example: |
A windowing system defines a Window and some specializations,
e.g., IconWindow. These abstractions are implemented for
various platforms, e.g., Unix, Apple, Microsoft.
|
| Solution: |
| Abstraction |
Defines the abstraction.
Keeps a reference to an object of type Implementor. |
| RefinedAbstraction |
Extends the interface defined by Abstraction. |
| Implementor |
Defines the interface for implementation classes. |
| ConcreteImplementor |
Implements the Implementor. |
|
| See also: |
Adapter
(applied after coding, whereas Bridge is applied in design)
Delegation
|