Design pattern > Structuraux > Bridge
Ce patron permet de découpler une abstraction de son implémentation, de telle manière qu'ils peuvent évoluer indépendamment.
Il consiste à diviser une implémentation en deux parties : une classe d'abstraction qui définit le problème à résoudre,
et une seconde classe qui fournit une implémentation. Il peut exister plusieurs implémentations pour le même problème et la classe
d'abstraction comporte une référence à l'implémentation choisie, qui peut être changée selon les besoins.
Le patron bridge est fréquemment utilisé pour réaliser des récepteurs d'événements.
Abstraction (BusinessObject)
- defines the abstraction's interface.
- maintains a reference to an object of type Implementor.
RefinedAbstraction (CustomersBusinessObject)
- extends the interface defined by Abstraction.
Implementor (DataObject)
- 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 (CustomersDataObject)
- implements the Implementor interface and defines its concrete implementation.
Jim Jones
Samual Jackson
Allen Good
------------------------
Customer Group: Chicago
Jim Jones
Samual Jackson
Allen Good
Ann Stills
Lisa Giolani
Henry Velasquez
------------------------