core practice · system design prompt

In-process pub/sub bus

Build an in-memory event bus: publishers fire events, subscribers register handlers by topic. Decide sync vs async delivery, error isolation, and unsubscribe semantics.

The mechanism

The observer pattern decouples who emits an event from who listens. Publishers fire events, subscribers register handlers, and the event bus is the registry that connects them. The tradeoff: flows are no longer visible in a single call stack, so debugging gets harder.

Study Observer Pattern

Expected evidence

Bus interface (publish, subscribe, unsubscribe) + the subscriber registry data structure.

Try this drill in the practice workspace →

Hints when you need them
  • What happens if one subscriber throws?
  • Keep the bus simple — no ordering guarantee unless asked.

Check the sources

Browse all practice briefs