What Is the Adapter Pattern?
A travel plug adapter does not rebuild your charger or rewire the foreign wall socket — it simply sits between the two, translating one shape into the other. The Adapter pattern gives your code that same quiet superpower. This thirteen-chapter guide unpacks the formal Gang-of-Four definition, a little history, why rewriting the old class is usually not on the table, the four-role anatomy (Target, Client, Adaptee, Adapter) with an SVG diagram, a step-by-step Python legacy-printer example, object vs class adapters, real-world use cases from legacy integration to cloud migration, how it differs from Facade and Decorator, pros and cons, common pitfalls, an FAQ, and a seven-line takeaway.