Difference between revisions of "Bridge"
(→UML Structure) |
(→Participants) |
||
Line 8: | Line 8: | ||
== Participants == | == Participants == | ||
+ | The classes and/or objects participating in this pattern are:<br /> | ||
+ | <ul> | ||
+ | <li>'''Abstraction'''</li> | ||
+ | <ul> | ||
+ | <li>defines the abstraction's interface</li> | ||
+ | <li>maintains a reference to an object of type Implementor</li> | ||
+ | </ul> | ||
+ | <li>'''Refined Abstraction</li> | ||
+ | <ul> | ||
+ | <li>extends the interface defined by Abstraction.</li> | ||
+ | </ul> | ||
+ | <li>'''Implementor'''</li> | ||
+ | <ul> | ||
+ | <li>defines the interface for implementation classes. This interface does not have to correspond exactly to Abstraction's interface; in fact the two interfaces can be quite different. The Implementation interface provides only primitive operations, and Abstraction defines high-level operations based on these primitives. | ||
+ | </ul> | ||
+ | <li>'''Concrete Implementor'''</li> | ||
+ | <ul> | ||
+ | <li>implements the Implementor interface and defines its concrete implementation.</li> | ||
+ | </ul> | ||
== Collaborations == | == Collaborations == |
Revision as of 18:19, 1 March 2007
Contents
Introduction
The bridge pattern is a design pattern used in software developing, decouple an abstraction from its implementation so that the two can vary independently. It is also known as Handle or Body.
UML Structure
Applicability
Participants
The classes and/or objects participating in this pattern are:
- Abstraction
- defines the abstraction's interface
- maintains a reference to an object of type Implementor
- Refined Abstraction
- extends the interface defined by Abstraction.
- Implementor
- defines the interface for implementation classes. This interface does not have to correspond exactly to Abstraction's interface; in fact the two interfaces can be quite different. The Implementation interface provides only primitive operations, and Abstraction defines high-level operations based on these primitives.
- Concrete Implementor
- implements the Implementor interface and defines its concrete implementation.
Collaborations
Consequences
Implementation
Code Examples
Related Patterns
Abstract Factory Adapter