SOLID & Design Patterns Interview Question #29

What is the difference between Adapter, Facade, and Proxy?

Structural, Creational & Behavioral Patterns Junior Beginner

Quick Interview Answer

Adapter changes an interface so an incompatible component can be used by a client. Facade simplifies access to a complex subsystem by presenting a higher-level interface. Proxy controls access to another object while generally preserving its expected interface.

Detailed Explanation

Adapter changes an interface so an incompatible component can be used by a client. Facade simplifies access to a complex subsystem by presenting a higher-level interface. Proxy controls access to another object while generally preserving its expected interface.

All three are structural patterns, but their intent differs: Adapter is about compatibility, Facade about simplification, and Proxy about controlled indirection.

Code Example

Adapter -> translate an interface
Facade  -> simplify a subsystem
Proxy   -> control access to an object