Login :
Password :

Design patterns

Bridge

Static diagram :

Static diagram

Description :

Type :  St  (Structural)
Intent : Decouple an abstraction from its implementation so that the two can vary independently.
Applicability : Use the Bridge pattern when :
- you want to avoid a permanent binding between an abstraction and its implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.
- both the abstractions and their implementations should be extensible by subclassing. In this case, the Bridge pattern lets you combine the different abstractions and implementations and extend them independently.
- changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.
- (C++) you want to hide the implementation of an abstraction completely from clients. In C++ the representation of a class is visible in the class interface.
- you have a proliferation of classes. Such a class hierarchy indicates the need for splitting an object into two parts. Rumbaugh uses the term "nested generalizations" to refer to such class hierarchies.
- you want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client. A simple example is Coplien's String class, in which multiple objects can share the same string representation (StringRep).

Strong points :

  1. 1. Extensibility
    1. 1.1 Addition or removal of a concrete implementor does not need code modification
    2. 1.2 Addition or removal of a refined abstraction does not need code modification
  2. 2. Decoupling between abstraction and implementor
    1. 2.1 Minimal number of concrete implementor
    2. 2.2 Maximal factorization of the link between abstraction and implementor

Pattern's participants :

Spoiled patterns :

  1. 1. Bridge development
  2. 2. Complete development from <<Abstraction>>
  3. 3. Complete deveopment from <<Implementor>>

Problems :

  1. 1. Display platform changing
Les têtes de mule
Cédric BOUHOURS
Cédric BOUHOURS
Cédric BOUHOURS