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.
Must do 6
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.