Saturday, January 17, 2015

Bridge Pattern

Type : Structural Design Pattern

Summary :


Bridge pattern separates the implementation from abstraction in object oriented world.
As a result of Bridge pattern two different object hierarchies can be assumed. The abstraction hierarchies can take the complexity of implementations that very and not related to the other hierarchies.

It can be considered as double abstraction.

Advantages:


Bridge pattern bridges two hierarchies, it results in less number of Classes, since the implementations can be plugged in to the abstraction in run time.

Bride in a way favors Composition over inheritence to make the dynamic pluggable implementation in runtime.


Example:


For our case, we will consider a simple example of DVD Player. We have different kind of DVD Players with different capabilities, like Operating Voltage, number of HDMI Slots and support for Different Disk types like BlueRay, 4K etc.


Class Diagram:





No comments :

Post a Comment