Bridge pattern used in software design whose importance is to decouple the abstraction from its actual implementation so two could vary individually. Bridge pattern uses aggregation, encapsulation and use inheritance to include separate responsibilities in different class.
In object oriented programming class varies often and these features become very useful where programs code can be change easily without any prior or minimal knowledge. Bridge pattern is very suitable where classes whatever it does vary often. We could think about class as implementation and whatever it does will be the abstraction.
Actually bridge pattern has two layers of abstraction on the object this makes us confuse with adapter pattern. You will see often bridge pattern implemented using class adapter pattern. Please see java code below:
- Implementor class:
- ConcreteImplementor 1
- ConcreteImplementor 2
- Refined Abstraction
- That’s it. Below is list of all design patterns link:
- Chain of Responsibility
- Template Method