Problem statement
Design the object model and core APIs for a podcast subscription manager: how one listener follows shows, learns about new episodes, and tracks play and download state per episode.
Operating context. One user, single in-process service. The listener subscribes to shows; each show has a feed that, when refreshed, yields episodes with an id, title, publish time, duration, and media reference. On refresh the manager detects episodes published since the last refresh and notifies interested observers, such as a badge counter or a download-all rule. Each episode carries a per-user playback state (new, in-progress with a resume position, played, archived) and, independently, a download state (not-downloaded, downloading, downloaded, failed). Per-show rules like auto-download or auto-archive-played run at refresh time.
Out of scope. Audio playback and decoding, the actual network fetching of feeds or media, RSS or XML parsing details, account and authentication, and cross-device sync.
What to produce. The class hierarchy (show, feed, episode, subscription, refresh service), the two per-episode state machines, and the new-episode notification mechanism. Be explicit about: how a refresh diffs the feed by episode id to find genuinely new episodes, the observer mechanism that fans out new-episode events, why playback and download are two independent state machines, and how per-show automation rules plug in without hard-coded branches.
Functional requirements
- Subscribe to and unsubscribe from a show.
- Refresh a show's feed and detect episodes published since the last refresh.
- Notify registered observers when new episodes appear.
- Track each episode's playback state (new, in-progress, played, archived) with a resume position.
- Track each episode's download state (not-downloaded, downloading, downloaded, failed).
- Apply per-show rules such as auto-download new episodes or auto-archive played ones.
Non-functional requirements
- Refresh diffing is O(m) in the number of feed items, keyed by episode id, not an O(n*m) rescan.
- New-episode notification uses an observer interface so adding a listener needs no change to refresh code.
- Playback and download state machines are independent, and every transition on each is validated.
- Per-show automation rules are pluggable strategies invoked on refresh, not hard-coded conditionals.
- The object model is unit-testable with synthetic feeds and an injected clock, never a network.
- Repeated idempotent refreshes never regress a resume position or re-notify for the same episode.
Topics
- System Design LLD
- Media Podcast
- Patterns Observer
- Patterns State
- Oop Solid