$> git checkout adapter
Intent
Convert the interface of a class into another interface that the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.1
Applications
Sometimes you want to use existing code but the interface does not match what you need. For example, you want to utilize vendor/outside code without rewriting all of your existing code. It is analogous to fitting a square peg in round hole. A square peg can fit inside any round hole, provided the peg is small enough. You should take care to adapt what is needed because the more methods ...