Comparison
Adapter patternvsAnti-corruption layer
Adapter pattern
the library's method was called differently and returned the wrong shape, so you wrote a class that speaks both.
A wrapper that converts one interface into another the caller already expects, so two things that were not designed together can work together. The intent is incompatibility, and that is what separates it from the other three wrappers: the adapter's interface is deliberately different from the thing it wraps. It is the pattern that keeps a third-party SDK from spreading through a codebase, which is the same argument the anti-corruption layer makes at the service boundary.
Full entry →Anti-corruption layer
you wrap the legacy system's awkward model in a translation layer so its concepts do not leak into your new code.
A translation boundary between your domain model and an external or legacy one. It keeps a foreign model's naming, quirks and constraints from spreading through your codebase. It costs an extra mapping layer, and it is what you wish you had built the first time a third-party field name ended up in your database.
Full entry →