Thursday, November 26, 2015


Adapter converts the interface of a class into another interface clients expect. It lets classes work together that couldn't otherwise because of incompatible interfaces.

Client will always call methodA(). The adapter converts this call into subclass method calls that are not compatible with the Adaptor interface. The Adapter can be seen as the wrapper of Adaptee 1 to N.

Check list

  1. Identify the players: the component(s) that want to be accommodated (i.e. the client), and the component that needs to adapt (i.e. the adaptee).
  2. Identify the interface that the client requires.
  3. Design a "wrapper" class that can "impedance match" the adaptee to the client.
  4. The adapter/wrapper class "has a" instance of the adaptee class.
  5. The adapter/wrapper class "maps" the client interface to the adaptee interface.
  6. The client uses (is coupled to) the new interface


Post a Comment

Note: Only a member of this blog may post a comment.