Bird
Raised Fist0

In the Observer pattern, what role does the 'Subject' play in UI updates?

easy🧠 Conceptual Q2 of Q15
LLD - Design — Chess Game
In the Observer pattern, what role does the 'Subject' play in UI updates?
AIt stores the UI components
BIt manages user input events
CIt holds the data and notifies observers on changes
DIt renders the UI elements
Step-by-Step Solution
Solution:
  1. Step 1: Define Subject's responsibility

    The Subject holds the core data or state in the Observer pattern.
  2. Step 2: Understand notification role

    When data changes, the Subject notifies all registered observers to update.
  3. Final Answer:

    It holds the data and notifies observers on changes -> Option C
  4. Quick Check:

    Subject role = Data holder and notifier [OK]
Quick Trick: Subject notifies observers when data changes [OK]
Common Mistakes:
MISTAKES
  • Thinking Subject renders UI
  • Confusing Subject with event manager
  • Assuming Subject stores UI components

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes