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
Diagram
Bridge
Participants
Abstraction
  • Defines the abstraction's interface.
  • Maintains a reference to an object of type Implementor.
RefinedAbstraction
  • Extends the interface defined by Abstraction.
Implementor
  • 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.
ConcreteImplementor
  • Implements the Implementor interface and defines its concrete implementation.