Adapter Design Pattern

Adapter Design Pattern

The Adapter Design Pattern, also known as the Wrapper, allows two classes to work together that otherwise would have incompatible interfaces.  In this case, this software design pattern maps particularly well to the real-world example of an electrical power adapter, which must be used to allow a device to use power.  For instance, most mobile devices today can be powered via some form of USB power, or via AC current.  However, in both cases there is no direct way for the device to plug into the wall or USB port.  The solution is an adapter.  In fact, in some cases adapters can be chained together, as in the case of a USB-to-Device cable that can also be plugged into a wall or car electrical outlet that has a USB power port.


Convert the interface of a class into another interface clients expect.  Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. [GoF]


Amazon - Design Patterns: Elements of Reusable Object-Oriented Software [GoF]

Videos - Design Patterns Library @ Pluralsight

Edit this page on GitHub

On this page