The document discusses the adapter pattern, a structural design pattern allowing incompatible interfaces to collaborate. It distinguishes between object adapters and class adapters and outlines their functionality and relationships with other design patterns such as facade, proxy, and decorator. The document highlights that the adapter modifies an object's interface without altering its existing functionalities.
ADAPTER ?
WHAT ISAN
“A device for connecting pieces of
equipment that cannot be connected
directly”
5.
“Adapter is astructural design pattern that
allows objects with incompatible interfaces
to collaborate.”
6.
Two Kinds of
Adapters
ObjectAdapters 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
1. The facadeuses 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 allabout
Adapter
Pattern !
Information in these slides are gathered from
pluralsight and medium