Loading LLD design...
Design an object-oriented music streaming platform (like Spotify) with an Artist → Album → Song catalogue, user subscriptions (Free/Premium/Family/Student), playlist management (Public/Private/Collaborative with add/remove/reorder), a full-featured music player with queue management, shuffle (Fisher-Yates with current song pinned), repeat modes (Off/One/All), and playback controls (play/pause/next/previous with 3-second restart rule).
The player loads a queue from an album or playlist and supports "add to queue" for inserting a song to play next. Shuffle preserves the currently playing song at index 0 while randomizing the rest, and toggling shuffle off restores the original order. The previous track command restarts the current song if more than 3 seconds have elapsed, otherwise goes to the previous track. Users can like songs, follow artists, and browse recommendations based on listening history.
Music catalogue
Add Artists, Albums (with cover art, genre, release date), and Songs (with duration, track number, featured artists)
User registration & subscriptions
Register users; upgrade to Free/Premium/Family/Student tiers
Playlist management
Create/edit playlists (Public/Private/Collaborative); add/remove/reorder songs; follow playlists
Music playback
Play song/album/playlist; pause/resume; next/previous track
Queue management
Load queue from album/playlist; add song to play next; maintain playback position
Shuffle & repeat
Toggle shuffle (Fisher-Yates with current song pinned); set repeat mode (Off/One/All)
Library & likes
Like/unlike songs; follow/unfollow artists and users; recently played history
Search
Search across songs, albums, artists, and playlists by keyword
Recommendations
Genre-based recommendations from listening history; top charts; new releases
Before diving into code, clarify the use cases and edge cases. Understanding the problem deeply leads to better class design.
Identify the primary actions users will perform. For a parking lot: park vehicle, exit vehicle, check availability. Each becomes a method.
Who interacts with the system? Customers, admins, automated systems? Each actor type may need different interfaces.
What are the limits? Max vehicles, supported vehicle types, payment methods. Constraints drive your data structures.
What happens on overflow? Concurrent access? Payment failures? Thinking about edge cases reveals hidden complexity.