Bridge Design Pattern in Java

One of the structural patterns, the Bridge Pattern, decouples an abstraction from its implementation so that two can vary independently. The bridge uses encapsulation, aggregation and also it can use inheritance to separate responsibilities into different classes.

The Bridge Pattern can be thought of as two layers of abstraction. This pattern involves an interface which acts as a bridge which makes the functionality of concrete classes independent from interface implementer classes. Both types of classes can be altered structurally without affecting each other.

Decouple implementation from interface and hiding implementation details from client is the purpose of bridge design pattern.

The abstraction is an interface or abstract class and contains a reference to the implementer.
The refined abstraction is the child of the abstraction and takes finer details one level below. It hides the finer elements from implementers.
The implementer is likewise an interface or abstract class and higher level abstraction with basic operations.
Concrete implementers provide concrete implementation at run-time by implementing the above implementer. Continue reading “Bridge Design Pattern in Java”