Skip to content
LLD Learn/Structural Patterns
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

Facade

3 min read

You'll learn to

  • -Explain Facade as one simple entry point over several classes that must be used together
  • -See with numbers how a facade removes repeated, order-sensitive code
  • -Know that Facade usually appears as a "this is getting complicated" follow-up, and what must not go inside it

Walk into a hotel and say "I'd like a table for two at eight". You do not phone the kitchen, the dining room manager and the cloakroom separately. The concierge handles all of that, and you deal with one person. The Facade pattern is the concierge of a program: a single, simple entry point placed in front of a group of classes that must be used together, in a particular order.

Facade does not hide the other classes. Callers who need fine control can still use the underlying classes directly, but most callers only ever need the facade.

A Home Theater Example

Starting a movie "properly" might mean dimming the lights, lowering the screen, switching on the projector, setting the sound to surround and choosing the streaming input. That is five calls on four different objects, in the right order, every time. Run the demo to see the facade replace those five calls by one.

Press Run: the five-step coordination is hidden behind one method, not removed

The saving grows with the number of callers. Suppose 12 different screens in an app start a movie.

Places that must keep the five steps in the right order
12
without a facade: each screen repeats all five calls (60 calls)
1
with a facade: only watch_movie knows the order (12 simple calls)

If the order ever changes, say "dim the lights after lowering the screen", you fix one method instead of 12 copies, and nobody can forget a step.

When It Shows Up as a Follow-Up

Facade rarely appears in the first requirements of an LLD prompt. It usually arrives as the answer to "this is getting complicated, how would you simplify the API for new callers?" after you have built several subsystem classes. The moment to spot is: "three or four classes always get used together in the same sequence, and most callers should not need to know that sequence." Introducing a facade there feels natural, not bolted on.

A facade adds no new functionality. It only simplifies access to what already exists. If you find yourself writing new business logic inside the facade, that logic belongs in one of the subsystem classes instead.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!