LLD - Design — Online Shopping CartWhy is it important to avoid tight coupling between the subject and observers in a notification system?ATo force all observers to implement the same interface.BTo make the subject dependent on specific observer implementations.CTo ensure observers cannot receive notifications.DTo allow observers to be added or removed without changing the subject code.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand coupling in designTight coupling means components depend heavily on each other, making changes difficult.Step 2: Benefits of loose coupling in notificationsLoose coupling allows adding/removing observers freely without modifying the subject, improving flexibility.Final Answer:To allow observers to be added or removed without changing the subject code. -> Option DQuick Check:Loose coupling = flexible observer management [OK]Quick Trick: Loose coupling enables flexible observer changes [OK]Common Mistakes:MISTAKESThinking tight coupling is beneficialBelieving subject should depend on observersAssuming observers cannot receive notifications
Master "Design — Online Shopping Cart" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Thread safety in design - Quiz 4medium Advanced LLD Concepts - Anti-patterns to avoid - Quiz 15hard Design — Chess Game - Board and piece hierarchy - Quiz 3easy Design — Food Delivery System - Notification to all parties - Quiz 10hard Design — Food Delivery System - Order tracking state machine - Quiz 14medium Design — Online Shopping Cart - Payment strategy pattern - Quiz 9hard Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 13medium Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 2easy Design — Splitwise (Expense Sharing) - Why Splitwise tests financial logic - Quiz 2easy Design — Splitwise (Expense Sharing) - Why Splitwise tests financial logic - Quiz 15hard