intermediateAdapter Pattern

How is the Adapter pattern different from the Facade pattern, given that both wrap other classes?

Adapter and Facade both introduce a class that sits in front of existing code, but they solve different problems. Adapter exists to make one incompatible interface compatible with what a client already expects -- it typically wraps a single class and translates its exact shape, one to one. Facade exists to simplify access to a subsystem that is already functionally correct but complicated to use directly -- it typically coordinates several classes behind one simpler method, without trying to match any specific interface the client already depends on. In short, Adapter is about compatibility between two shapes, while Facade is about hiding coordination complexity behind a simpler entry point.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to The basic Command interface only has an execute() method. What has to change to support undo?← Back to all Low-Level Design & Design Patterns questions