1.Topics‎ > ‎Architecture‎ > ‎Patterns‎ > ‎a.Design Patterns‎ > ‎C.Structural Patterns‎ > ‎

B.Bridge

  1. Summary
    1. The intent of this pattern is to decouple abstraction from implementation so that the two can vary independently.
    2. Actually Adapter Pattern + Strategy Pattern =Bridge Pattern 
    3. This allows further decoupling and target implementation and adapter both can be changed at run time.
  2. Class Diagram

    1.  Abstraction (Abstract Class) contains an instance of Implantation interface and this relationship is called bridge.
    2.  Abstraction route calls to  Implantation via its interface
  3. Example
    1. Implantation of generic TV remote
  4. Special Considerations
    1. Bridge Vs Adapter
      1. Bridge is actually extension of adapter pattern by combining with strategy. 
      2. Both solve decoupling purpose but bridge is more loosely coupled. 
      3. Adapter : 
        1. Client Holds Adapter>> Adapter holds Adoptee
      4. Bridge
        1. Abstraction of Client Holds Adoptee Interface (Implantation) Instance and routes calls to Adoptee.
        2. That means several version of client can use same adapter.
        3.  It is useful when adapter is subjected to change in future. (That implement strategy)