Friday, December 27, 2019

Adapter Design Pattern

Adapter Pattern
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
  • Adapter is a structural design pattern.
  • The adapter design pattern is a software design pattern that allows the interface of an existing class to be used as another interface. It is used to make existing classes work with others without modifying their source code.Which allows incompatible objects to collaborate.
  • The Adapter acts as a wrapper between two objects. It get data from one object and transforms them to format and interface recognizable by the second object.
  • Adapter pattern works as a bridge between two incompatible interfaces. 
  • An Adapter Pattern says that just "converts the interface of a class into another interface that a client wants".
  • An Adapter pattern acts as a connector between two incompatible interfaces that otherwise cannot be connected directly.
Adapter design pattern example:
Let's assume we have an existing student object and we want to convert this as employee object after candidate selection process completed.

No comments:

Post a Comment