Adapter pattern adapts a piece of code to work with another. In real world, consider a battery charger for your phone. If you went for vacation to a somewhere in Europe, your charger won’t fit into the wall outlet. You would need a piece that can wrap your that fits into the socket in Europe.
Adapter pattern is usually helpful to create new code that is compatible with old legacy code. Using adapter pattern the old code do not need to be changed to work with new code.
[Read more…]