Machine Coding - Music Recommendation System
Machine Coding - Music Recommendation System
Problem Definition:
Create an online music recommendation system which suggests songs according to user taste.
Features:
Application has two major things :
1. The songs, which are catalogued in the app’s data store. Songs can be described by
attributes such as genre, tempo, singer.
2. The people : Each person has a playlist of songs that they can choose to play from.
Design a system that recommends a set of songs from our music library to the user based on
his preferences (matching genre / singer/ tempo) taking into account his current playlist.
Pick a song based on the following order:
1. One which matches with maximum matching attributes.
2. When only one attribute is matching, pick one in the following order : genre > singer >
tempo.
3. To decide priority between two genres\singer\tempo, consider the number of songs in
each category in user’s playlist to decide which song gets more priority. One with higher
number of songs gets high priority. If number of songs are same, show in any order.
Show the recommended songs in a sorted order(Most matched one first, least matched in the
last)
Requirements:
1. Add a new song to data store.
2. Add a new user to the system.
3. Create a playlist for the user (Assume single playlist for simplicity)
4. Add songs to the user’s playlist
5. Display user’s playlist
6. Recommend songs based on user preferences
Bonus question:
1. Extend the system to let users add friends.
add_friend(“user”, “friend1”)
2. Recommend songs based on the user and his friends playlist.
Other Details:
1. Do not use any database or NoSQL store, use in-memory store for now.
2. Do not create any UI for the application.
3. Code should be demo able. Write a driver class for demo purpose, which will execute all
the commands at one place in the code and test cases.
4. Code should be extensible. Wherever applicable, use interfaces and contracts between
different methods
5. Work on the expected output first and then add good-to-have features of your own.
Test Cases:
(Test cases are defined for understanding feature requirements only. Please model it appropriately based on your service
implementation)