© Dmitri Nesteruk 2020
D. NesterukDesign Patterns in .NET Core 3https://doi.org/10.1007/978-1-4842-6180-4_7

7. Adapter

Dmitri Nesteruk1  
(1)
St. Petersburg, c.St-Petersburg, Russia
 

I used to travel quite a lot, and quite often only when you arrive in a new country, you remember that their sockets are different and you didn’t prepare for this. This is why airport travel shops carry travel adapters, and also why some hotels (the better ones) have at least one outlet of a nonlocal type just in case a customer has forgotten to get an adapter, but needs to, say, work on their laptop without interruption.

A travel adapter that lets me plug a European plug into a UK or US socket1 is very good analogy to what’s going on with the Adapter pattern in the software ...

Get Design Patterns in .NET Core 3: Reusable Approaches in C# and F# for Object-Oriented Software Design 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.