juniorDesign Patterns
What is the Adapter Pattern?
Updated Apr 28, 2026
Short answer
A structural pattern that allows objects with incompatible interfaces to collaborate.
Deep explanation
The adapter acts as a wrapper. It catches calls for one object and transforms them to format and interface recognizable by the second object. It's often used to make existing classes work with others without modifying their source code.
Real-world example
A power adapter that allows a US plug to fit into a European wall outlet.
Common mistakes
- Using an Adapter to add new features rather than just translating interfaces (which is the job of a Decorator).
Follow-up questions
- What is the difference between Object Adapter and Class Adapter?