Bridge Pattern

Summary

  • The Bridge pattern allows for development of an interface and implementation of a component to proceed independently.
  • The Bridge pattern decouples an abstraction from its implementation, enabling them to vary independently.
  • The Bridge pattern is useful when a new version of software is brought out that will replace an existing version, but the older version must still run for its existing client base.
  • The Abstraction component is what is commonly called a Portal.

Class diagram: (see Bridge Pattern code review)

Bridge Pattern class diagram of sample code download

Usage

Use the Bridge pattern when you want to:

  • Completely hide implementations from clients.
  • Avoid binding an implementation to an abstraction directly.
  • Change an implementation without even recompiling an abstraction.
  • Combine different parts of a system at runtime.