3.1. Design A Recipe Recommending App
3.1. Design A Recipe Recommending App
This is the last LLD class. More assignments over the weekend. Please don't feel pressurized.
For each entity - create a table attributes - columns of the corresponding table relations - 1 - 1 relation (composition) -> the
owned entity has a FK to the owner entity. (Car table will have car_id, color, model, and a fk to driver_id) - 1 - 1 relation (no
composition) -> separate mapping table. PK of that will be the fkeys of the corresponding entities. you will add a unique and
not null contraint to both the fk cols separately.' - 1 - * - * - *
player
human
cpu
modes
Design a filesystem based DB to store images - key-value type filesystem based database
User 1 - * Kitchen
which users have which kitchens. hypothetical - what is the probability of the user being at a given kitchen
User_kitchens Table --------pk--------- (user_id, kitchen_id) probability 1 1 0.3 1 2 0.7 2 3 0.5 2 2 0.5
Recommendation - always create a separate mapping table no matter what the relationship is.
optional 1-1
You're not sure what you want to eat - and maybe you're feeling a little adventurous. It would be great it someone could tell
you what awesome new dish you could make out the ingredients you have.
Being an software developer by profession and entrepreneur at heart, you just get this awesome idea to build an app to
recommend you recipes!
user should be able to provide the list of the ingridients they have in their kitchen
given these ingridients the app should suggest recipe
we will use some sort of API / scrape the web to get data about the recipies.
ingirients that are needed for this recipe
whatever other details we can collect
store this in a database
E-R analysis
Recipe - id - name - time to prepare - prepration instructions - source: where did we scrape this recipe from
Kitchen - id - name
User * - * Kitchen
Enum for the category -> stored in the DB Want a class hierarchy for the categories
interface RecipeRecommedationStrategy {
List<Recipe> recommend(Kitchen);
}
class RecipeRecommendationService {
private RecipeRecommedationStrategy recipeRecommedationStrategy;
List<Recipe> recommend(Kitchen) {
// use my strat to recommend
}
}
It would be nice if the app could "assume" that some other ingredients were also available and suggest recipes based on
them? Maybe you could go out to the supermarket to purchase those ingredients and then follow that recipe.
You would like the app to also "suggest" recipes that might require you to buy some extra stuff from the supermarket.
Socializing
Your app is awesome, and you can't help but tell all your friends and coworkers about it. Everyone agrees that deciding what
dish to make is always a huge annoyance. They want to check out the app too!
How do you modify your app so that your friends can use it too?
1. Suggest features
80-20 principle
Okay
Bad
Debugging issues in prod - junior vs senior developer Performance monitoring Error tracking
TicTacToe
Board CellValue - Tic / Tac / Toe Move -> where on the board was what placed Player
Game Service -> board, tracking the list of moves that the players make
Uber - interview will give you a question - laptop walk out. come back after 30 mins
~1 month of HLD - currently this app is being used by 10 people - this app has 1 million users + performance monitoring + a
person in US and a person in India they both get low latencies + how do you make sure that while handling transactions
there's no mistake + analytics + caching + NoSQL databases + CDNs / load balancing + Large scale problems + how do you
go from 10 users to 10 million users - billion users
leaderboard - service -> db query to fetch the top 10 scores (expensive) caching architecture / hooks
4500 students -> Scaler does NOT have scale problem at present.
Google.com -> 1 sec to load -> annoyed! Paytm transaction -> 5 sec -> okay!