Member-only story
Adapter design pattern
4 min readDec 30, 2023
The adapter design pattern is a bridge between the expected interface and the existing interface, which means filling the page between the expected interface and the existing interface.
Adapter Design Pattern is used so that two unrelated or incompatible interfaces can work together.
The main goal for this pattern is to convert an existing interface into another one the client expects.
Adapter Pattern is also known as Wrapper.
Advantages of Adapter Pattern
- Facilitates Integration: The Adapter pattern can facilitate the integration of different systems or components by providing a common interface that both can understand.
- Flexibility: You can swap or extend the adapters without affecting the rest of the system.
- Re-usability: Adapters can be reused with different adaptees, making it easy to use the same adapter with different systems.
- Improves Readability and Usability: The Adapter pattern allows the client code to remain separate from the adaptee code, which makes it easier to modify.
- Reduces Dependencies: The Adapter pattern can improve code maintainability by reducing the number of dependencies between components.
Disadvantages of Adapter Pattern
- Increases Complexity: The use of adapters can add additional layers of complexity to the codebase, which can make it harder to understand and maintain.