⌘K
Flycodx

Observer Pattern: Event Notification System

Observer Pattern: Event Notification System

EasyLLD0% accepted

Implement Observer pattern for an event notification system. Stock price monitor notifies multiple subscribers (Logger, EmailAlert, SMSAlert) when price changes. Also discuss push vs pull observer variants.

Approach

Implement Observer pattern with multiple subscribers for event notification.

Input

StockMonitor has 3 observers; price changes from 100 to 120

Output

notifyObservers() calls update(120) on Logger, EmailAlert, SMSAlert; all three receive new price

Scenarios & Expected Answers

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On