Bridge
Usage
- Also known as: Handle / Body
- Separate an object’s interface from its implementation
- Decouple an abstraction from its implementation so that the two can vary independently
Participants
Abstraction
RefinedAbstraction
- Defines the abstraction's interface.
- Maintains a reference to an object of type Implementor.
Implementor
- Extends the interface defined by Abstraction.
ConcreteImplementor
- Defines the interface for implementation classes. This interface doesn't have to correspond exactly to Abstraction's interface; in fact the two interfaces can be quite different. Typically the Implementation interface provides only primitive operations, and Abstraction defines higher-level operations based on these primitives.
- Implements the Implementor interface and defines its concrete implementation.
