Tuesday, 30 August 2016

Adapter Design Pattern in Java with Example

Adapter design pattern in Java, also known as the Wrapper pattern is another very useful GOF pattern, which helps to bridge the gap between two classes in Java. As per the list of Gang of Four patterns, Adapter is a structural pattern, much like Proxy, Flyweight, Facade, and Decorator pattern in Java. As the name suggest, Adapter allows two classes of a different interface to work together, without changing any code on either side. You can view Adapter pattern is a central piece of the puzzle, which joins two pieces, which can not be directly joined because of different interfaces. I see a couple of reference of Adapter design pattern in one of my favorite book Clean Code, but the idea is very well explained in Head First Design Pattern, the image which they show to illustrate Adapter design pattern is worth all the talk.
Read more »

No comments:

Post a Comment