In a world full of different types of cables and plugs, we have all become accustomed to the concept of adapters. The Adapter pattern will be one of those patterns that will be easy for you to grasp because it correlates so perfectly with our real-world experiences with technology. The Adapter pattern's name perfectly reveals its core purpose; it offers us a way to seamlessly use old code with new code by adding an interface between the code that will act as an adapter.
The following topics will be covered in this chapter:
- Understanding the Adapter pattern
- Implementing the Adapter pattern
The examples presented in this chapter are skeleton code. It's simplified for learning purposes so we can focus on the structure of the pattern. It might not be optimized or contextualized enough to be used as is in your project.