Structural - Adapter Pattern

-- by Vikram

This is one of that pattern that you can remember as the Jugaad pattern, in most times you will know when to use this pattern. Adapter makes a type look like another so as it can be utilized with minimum changes to existing system which currently implements a specific interface. 

Jugaad is like you know exactly what you want and you are either in resource crunch or just want to be frugal and make things work right. In someway I believe it's smart way of doing things at times. A practical example can be an implementation of a multi-database connector library where you will have an common interface that would allow users to select any type of database that is in the supported list. 

Whereas each of these databases will most likely have their own API(s) and in that can you would be writing adapters that wraps each of your original database API(s) and then you will have a single type that can be utilized in the same way.

Adapter adapts different types to be utilized in the same way, you can also see it as type conversion via wrapping your code in a common interface. 

Generally a ideal use case would be the third-party libraries or when your underlying framework upgrades with a breaking changes and you are either not yet ready to perform the largescale changes to your code as that would not bring enough advantage to you as it would have otherwise brought to the underlying framework. 

Adapter inherently in your code may not be really necessary.