CS FundamentalsVery hardProduct-company design interview

Both Facade and Mediator sit between groups of objects. What is the essential difference?

  1. A. There is no difference
  2. B. A Facade gives clients a simpler one-way interface to a subsystem whose classes don't know about it; a Mediator coordinates two-way communication among colleagues that know and talk through it
  3. C. A Mediator is always a Singleton while a Facade never is
  4. D. A Facade adds behaviour at run time like a Decorator

Correct answer: B. A Facade gives clients a simpler one-way interface to a subsystem whose classes don't know about it; a Mediator coordinates two-way communication among colleagues that know and talk through it

Subsystem classes are unaware of a Facade, which simply hides complexity. Colleagues in a Mediator send their messages to it and receive from it, so it centralises their interaction logic.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic