Bird
Raised Fist0

Which of the following problems CANNOT be effectively solved using the Observer Pattern (Event System, Publish-Subscribe)?

easy🔍 Pattern Recognition Q2 of Q15
OOP & Design Patterns - Observer Pattern - Event System, Publish-Subscribe
Which of the following problems CANNOT be effectively solved using the Observer Pattern (Event System, Publish-Subscribe)?
ANotifying multiple UI components when data changes
BSelecting an algorithm at runtime based on input
CBroadcasting state changes to multiple listeners
DImplementing a plugin system where plugins react to events
Step-by-Step Solution
Solution:
  1. Step 1: Analyze each option

    Options A, B, and D involve notifying multiple listeners; these are valid use cases for Observer.
  2. Step 2: Identify anti-pattern

    Selecting an algorithm at runtime based on input is about algorithm selection, which is the Strategy Pattern, not Observer.
  3. Step 3: Confirm correct answer

    Only Selecting an algorithm at runtime based on input cannot be solved by Observer Pattern.
  4. Final Answer:

    Option B -> Option B
  5. Quick Check:

    Algorithm selection is Strategy, not Observer [OK]
Quick Trick: Algorithm selection -> Strategy, not Observer [OK]
Common Mistakes:
MISTAKES
  • Confusing Strategy with Observer
  • Assuming all event broadcasting fits Observer
  • Ignoring coupling requirements
Trap Explanation:
PITFALL
  • Candidates often pick broadcasting as invalid, but it's a core Observer use case; algorithm selection is the true anti-pattern here.
Interviewer Note:
CONTEXT
  • Tests ability to distinguish Observer from other design patterns and recognize anti-patterns.
Master "Observer Pattern - Event System, Publish-Subscribe" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes