System Design
15. Software Design PatternsAnimated walkthrough
Bridge Pattern
Separate an abstraction from its implementation.
The idea
Two hierarchies vary independently, such as shapes and rendering engines.
Watch it work
The steps light up one at a time. Use the controls to pause or step through.
- 1Define the abstraction
- 2Define the implementation interface
- 3Abstraction holds an implementation
- 4Mix freely
1/4
Step by step
- 1Define the abstraction
- 2Define the implementation interface
- 3Abstraction holds an implementation
- 4Mix freely
Where it is used
Avoiding class explosion.
Watch out for
Added complexity for simple cases.