Bridge Pattern
This lesson discusses the decorator pattern in detail with the aid of a coding example.
We'll cover the following
What is the bridge pattern?
The bridge pattern allows separate components with separate interfaces to work together. It keeps an object’s interface separate from its implementation, allowing the two to vary independently.
An example is controlling an air conditioner with a remote. The air conditioners can be of different types and each of them is controlled by a different remote. The remotes can vary, that is, a new one with better features can be introduced, but that won’t make any changes to the air conditioner classes. The same goes the other way round. The bridge pattern allows input and output devices to work together but vary independently.
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.