The adapter pattern

The name adapter is derived from the real world, wherein we have various adapters being used in electrical and mechanical domains. While building an application, we often come across scenarios where we have to integrate with other applications/code, which are incompatible. Often, this results in lots of changes being made to either the base code or third-party code. But, in real-world scenarios, there can be various reasons wherein changes cannot be made to either the base code or third-party code or even both.

Note

The adapter design pattern enables two incompatible classes to interact with each other, without those classes knowing about each other's implementation.

Universal Call Center is expanding and wants to enable its customers ...

Get Apex Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.