​Why Adapter Design Pattern got introduced.

Take example of a smart phone user when you try to open the document in .doc format it simply pass the request to the Microsoft Word installed on the android phone.
The Adapter deign pattern lets incompatible interfaces work together while taking care it should not break client code or it should not ask client to make changes to its code.

This design pattern enables us to implement and update functionalities without changing anything in the client side code.
Benefits of Adapter Design pattern:

Why this pattern is so popular because it allows the objects having different interfaces to communicate with each other.
How it Works?
Here Adapter class extends the Adaptee. Benefit is it can even add more functionality to the existing class.

The below example is using is a relationship where tap is a shower.

The next type for implementing using has a relationship where instead of extending the instance of class is used to access the methods.

Ifyou really liked my tutorial please share it, show your love.

God bless youdesign pattern in java

Leave a Reply

Your email address will not be published. Required fields are marked *