Applied Design Patterns with Java

Structural :: Bridge (151) {C ch 10}


Collaborations

Consequences

The Bridge pattern has the following consequences:

  1. Decoupling interface and implementation. An implementation is not bound permanently to an interface. The implementation of an abstraction can be configured at run-time. It's even possible for an object to change its implementation at run-time. Decoupling Abstraction and Implementor also eliminates compile-time dependencies on the implementation. Changing an implementation class doesn't require recompiling the Abstraction class and its clients. This property is essential to ensure binary compatibility between different versions of a class library. This decoupling encourages layering that can lead to a better-structured system. The high-level part of a system only has to know about Abstraction and Implementor.
  2. Improved extensibility. Bridge allows extending the Abstraction and Implementor hierarchies independently.
  3. Hiding implementation details from clients. Bridge allows shielding clients from implementation details, like the sharing of implementor objects and any accompanying reference count mechanism.

Catalog Structural Prev Next