Adapter: Introduction
Get a brief introduction to the Adapter design pattern.
We'll cover the following
The Adapter design pattern is used when we need to access some endpoint that isn’t compatible with the rest of our application, but we have no means of changing the endpoint. It has many real-life analogies.
Different regions of the world have different electric sockets. For example, a socket somewhere in continental Europe works with a plug that has two pins, while a British socket works with a three pin plug. So, if we buy some electric appliance in Britain and then travel to continental Europe with it, we won’t be able to plug it directly into a socket. We’ll need to get a socket adapter. This adapter will have two pins, which will allow it to be connected to a European socket, but it will also have a socket of its own, which will accept a British plug.
Get hands-on with 1400+ tech skills courses.