Professional Documents
Culture Documents
Bridge Pattern
Bridge Pattern
*GoF
Bridge Pattern
*GoF
**wtf?
Bridge Pattern
Separate a varying entity from a varying behavior
(separate an "abstraction" from its
"implementation"), so that these issues can vary
independently.
Implementor
Abstraction
+OperationImp()
+Operation()
+OperationImp() +OperationImp()
+Operation() +Operation()
An Example
Circle
+draw()
An Example
Shape
+draw()
Circle Rectangle
+draw() +draw()
An Example
Shape
+draw()
Circle Rectangle
+draw() +draw()
Vector DoubleCircle
+draw()
Drawing Implementation
Shape
+drawRect()
(protected ) myDrawImp +drawCircle()
+Draw()