intro practice · system design prompt
Notification factory
Design a Notification factory that returns Email / SMS / Push notifiers from a single create(type, payload) call. Show where channel-specific config lives.
The mechanism
Creational patterns (Factory, Builder, Singleton) hide how an object is constructed so callers do not pin themselves to a specific concrete class. They earn their keep when you add the 4th variant without callers needing to change.
Expected evidence
Factory + 3 concrete notifiers + the registration mechanism for adding a 4th.
Try this drill in the practice workspace →
Hints when you need them
- Map of type → constructor beats a switch.
- Keep the factory dumb; let notifiers carry their own config.