Tier: 4 — Hard Domain: Entertainment / Media Core Patterns: Observer (playback events/notifications), Strategy (shuffle/recommendation), Decorator (player feature augmentation), Iterator (playlist traversal)
Phase 1: Requirements & Use Cases
Interviewer: "Design a music streaming service like Spotify."
Candidate: "Let me make sure I'm scoping this correctly. I'm thinking of the OOD layer — the domain model for managing songs, albums, artists, playlists, and playback. This is not a distributed systems design: I'm not covering CDN delivery, microservices, or audio encoding pipelines. Does that match your expectation?"
Interviewer: "Yes, domain model only. What do you want to clarify?"
Candidate: "A few things. First — are we covering both Free and Premium subscription tiers, and do they have different feature sets? Second — do we need collaborative playlists, or just personal ones? Third — are we modeling audio quality selection (e.g., 160 kbps vs 320 kbps), or just playback controls? Fourth — do we need a recommendation engine, or just shuffle and sequential play?"
Interviewer: "Yes to Free/Premium tiers with feature differences. Personal playlists only. Skip audio quality — assume Premium always gets high quality. Include shuffle as a playback strategy; skip the recommendation engine."
Candidate: "Perfect. The actors are:
User(listening, managing playlists),Artist(associated with songs and albums), andMusicLibrary(the catalog). The core use cases are: (1) browse and search the music library; (2) create and manage playlists — add, remove, reorder songs; (3) play a song, album, or playlist; (4) control playback — play, pause, skip, previous; (5) apply playback mode — sequential, shuffle, repeat-one, repeat-all; (6)…
In the full tutorial
- Phase 2: Object Modeling
- Phase 3: Class Design & Relationships
- Phase 4: Design Patterns Application
- Phase 5: Key Implementation
- Phase 6: Extensibility & Trade-offs