jargon

Comparison

Adapter patternvsFacade pattern

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.

speaks its interfaceClientAdapterAdapteeone object, a different interface
Full entry →

Facade pattern

you replaced eleven calls across four classes with one method, and callers stopped needing to know the order.

A single simplified entry point over a subsystem of several collaborating classes. Its intent is simplification rather than translation: the facade defines a new, smaller interface where the adapter conforms to an existing one, and it typically wraps many objects where the other wrappers wrap one. It does not hide the subsystem — callers who need the detail can still reach past it, which is the difference between a facade and a boundary.

ClientFacadePart APart BPart Cmany objects, a smaller interface
Full entry →

Related comparisons