CS FundamentalsVery hardProduct-company design interview
Both Facade and Mediator sit between groups of objects. What is the essential difference?
- A. There is no difference
- 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
- C. A Mediator is always a Singleton while a Facade never is
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A Customer may or may not have a discount policy. Instead of writing if policy is not None: total = policy.apply(total) everywhere, the…
- Which form of dependency injection makes required dependencies explicit and allows the object to be immutable and fully initialised as…
- A message broker delivers each message at least once, so consumers sometimes see duplicates (for example after a crash before an ack). A…
- Match the delivery guarantee. P: the consumer acks a message before processing it. Q: the consumer acks only after processing succeeds. R…
- In CQRS, what is separated, and what is a typical consequence?
- A method has cyclomatic complexity 25. Which conclusion is most reasonable?