Adapter Design Pattern

Learn about the adapter design pattern.

Overview

We often use adapters in real life. Suppose we traveled from the US to the UK with a laptop. Our charger won’t plug directly into the power outlet in the UK because they’re incompatible. We can solve this problem by placing an adapter between the plug and the power socket.

In programming, the concept is the same. Suppose that we have code that interacts with the ...