LLD - Behavioral Design Patterns — Part 2Find the mistake in this Observer pattern usage: Observers modify the Subject's state directly upon notification.AObservers must always modify Subject's stateBObservers should not modify Subject's state directlyCSubject should notify Observers only onceDObservers should poll Subject instead of receiving notificationsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Observer pattern rolesSubject owns state; Observers react to changes but do not change Subject directly.Step 2: Identify correct behaviorObservers should not modify Subject's state to avoid tight coupling and maintain separation of concerns.Final Answer:Observers should not modify Subject's state directly -> Option BQuick Check:Observer respects Subject's state ownership = A [OK]Quick Trick: Observers react, don't modify Subject's state [OK]Common Mistakes:MISTAKESAllowing observers to change Subject stateConfusing notification with pollingAssuming single notification is enough
Master "Behavioral Design Patterns — Part 2" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Behavioral Design Patterns — Part 1 - Template Method pattern - Quiz 2easy Behavioral Design Patterns — Part 1 - State pattern - Quiz 7medium Behavioral Design Patterns — Part 1 - State pattern - Quiz 10hard Behavioral Design Patterns — Part 2 - Memento pattern - Quiz 15hard Behavioral Design Patterns — Part 2 - Null Object pattern - Quiz 2easy Behavioral Design Patterns — Part 2 - Visitor pattern - Quiz 11easy Behavioral Design Patterns — Part 2 - Interpreter pattern - Quiz 15hard Design — Elevator System - Scheduling algorithm (SCAN, LOOK) - Quiz 2easy Design — Library Management System - Reservation and hold system - Quiz 4medium Design — Tic-Tac-Toe Game - Command pattern for undo - Quiz 2easy