System design interview question
Design Observer Pattern (Pub/Sub in Memory)
A foundational in-memory Observer (publish/subscribe) implementation with a Subject base class that maintains a list of Observers, supports attach/detach/notify operations, and offers both push and pull notification models. We model a WeatherStation broadcasting to multiple displays, discuss ordering guarantees, reentrancy hazards, and how the pattern scales into an Event Bus. Implemented in TypeScript, Java, and C++.
Practice this question step by step with an AI interviewer that reviews your requirements, your architecture and your trade-offs, and scores the design.