4. ADAPTER ?
WHAT IS AN
“A device for connecting pieces of
equipment that cannot be connected
directly”
5. “Adapter is a structural design pattern that
allows objects with incompatible interfaces
to collaborate.”
6. Two Kinds of
Adapters
Object Adapters Class Adapters
Hold an instance of the Adaptee
Implement or inherit the Adapter type
Use composition and single inheritance
Inherit from the Adaptee
Implement the Adapter interface
Require multiple inheritance
18. 1. The facade uses a new interface, the adapter uses the
old interface.
2. The adapter provides a different interface for the
object. Proxy provides the same interface. The
decorator provides an extended interface.
3. The bridge is designed so that abstraction and
implementation are independent of each other. Thanks to
the adapter, unrelated classes are to cooperate with
each other.
4. The adapter is used to change the interface of an
existing object. The decorator improves another object
without changing its interface.
Relations with other design patterns :
19. Summary :
That’s all about
Adapter
Pattern !
Information in these slides are gathered from
pluralsight and medium