Bird
0
0

In a complex UI system with many components, how does the Mediator pattern improve scalability and maintainability?

hard📝 Trade-off Q9 of 15
LLD - Behavioral Design Patterns — Part 2
In a complex UI system with many components, how does the Mediator pattern improve scalability and maintainability?
ABy removing the need for any communication between components.
BBy increasing direct communication between all components.
CBy reducing the number of direct connections and centralizing control logic in one mediator component.
DBy duplicating event handling code in each component.
Step-by-Step Solution
Solution:
  1. Step 1: Identify challenges in complex UI

    Many components communicating directly create a tangled web of dependencies.
  2. Step 2: Role of Mediator pattern

    Mediator centralizes control, reducing direct links and simplifying maintenance.
  3. Final Answer:

    By reducing the number of direct connections and centralizing control logic in one mediator component. -> Option C
  4. Quick Check:

    Mediator reduces connections for scalability [OK]
Quick Trick: Mediator centralizes control to reduce complexity [OK]
Common Mistakes:
MISTAKES
  • Thinking more direct connections improve scalability
  • Duplicating event handling everywhere
  • Assuming no communication is needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes