Decouple an abstraction from its implementation so that the two can vary independently.
You need to extend a class in two independent dimensions. Using inheritance creates a complex hierarchy.
The Bridge pattern separates abstraction from implementation, putting them in separate class hierarchies that can vary independently.
- You want to avoid permanent binding between abstraction and implementation
- Both abstractions and implementations should be extensible by subclassing
- Changes in implementation should not impact clients
- You want to share an implementation among multiple objects
See the Program.cs file for shapes decoupled from rendering implementations.
- Can develop platform-independent classes and apps
- Client code works with high-level abstractions
- Open/Closed Principle - introduce new abstractions and implementations independently
- Code might become more complicated with many new classes
- Increased complexity in the design