Design Patterns interview question · Most asked

What is the Facade pattern?

Summary

Facade provides one simple, task-focused interface to a complex subsystem. An OrderFacade.place_order() coordinates inventory, payments, shipping and email in the right order, so callers don't repeat that sequence.

Longer Answer

The subsystem classes keep working and remain available for advanced use; the facade is a convenience, not a wall. It reduces duplication and coupling to the subsystem's details, and it is a natural boundary when layering a system.

Risk: a facade that does everything becomes a god object. Keep facades focused on one area.

Key Points

  • Simple front door to a complex subsystem.
  • Coordinates calls in the right order.
  • Subsystem still usable directly.
  • Keep it focused to avoid a god object.

Deep dive: Design Patterns, Explained Simply: Facade

Explanation

What interviewers look for

The simplification intent and the distinction from Adapter.

Follow-up questions

  • Are Laravel facades GoF facades?

More most-asked Design Patterns questions

← All Design Patterns questions