Grokking Design Patterns for Engineers and Managers
0% completed
Adapter Pattern
The Adapter Pattern makes an incompatible interface fit the one your code already expects.
Your application speaks one interface. Something you need to use speaks another. A payment library exposes charge(amountInCents, currencyCode), while your checkout calls pay(Money). A legacy service returns XML and everything downstream expects JSON. An analytics client wants track(String, Map) and your code produces an Event.
You cannot change the other side. It is a vendor library, another team's service, or code that fifty other callers depend on
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%