[go: up one dir, main page]

0% found this document useful (0 votes)
4 views3 pages

3.1. Design A Recipe Recommending App

The document outlines the design and requirements for a recipe recommending app that allows users to input available ingredients and receive recipe suggestions. It includes details on database schema, entity relationships, and potential strategies for enhancing user experience and app scalability. Additionally, it discusses features, business models, and architectural considerations for the app's development and growth.

Uploaded by

litesh.arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

3.1. Design A Recipe Recommending App

The document outlines the design and requirements for a recipe recommending app that allows users to input available ingredients and receive recipe suggestions. It includes details on database schema, entity relationships, and potential strategies for enhancing user experience and app scalability. Additionally, it discusses features, business models, and architectural considerations for the app's development and growth.

Uploaded by

litesh.arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Design a Recipe recommending app

1. This problem was built in layers.

This is NOT an AI problem.

Your user should be as minimal as possible.

27 submissions - tictactoe + pen - ER diagram submissions

interview of Palantir - for freshers they offer upto 35LPA base


for the Mumbai office they were about to open

This is the last LLD class. More assignments over the weekend. Please don't feel pressurized.

Entities, Relations, Attributes.

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 - * - * - *

Normaliation / Denormalization -> DBMS

Tic Tac Toe

CPU player - easy/med/hard mode

player

human

cpu

modes

design the DB schema for a particular problem

Design a filesystem based DB to store images - key-value type filesystem based database

key - path, value - file contents - metadata

User 1 - * Kitchen

recommended to create a seaparate mapping table

User table user_id | ...

Kitchen table kitchen_id | name 1 home 2 work 3 home

which users have which kitchens. hypothetical - what is the probability of the user being at a given kitchen

functional dependency kitchen_id -> probability X user_id + kitchen_id -> probabiliy

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

later you might want to change it to * - *

Recommendation - always create a separate mapping table no matter what the relationship is.

In practice - ORM solution composition - ORM solution won't do this.

optional 1-1

1-1 cannot have nulls

0/1 - 0/1 -> seprate mapping table

Design a Recipe recommending app


Situation: You're feeling peckish. You go to your kitchen and look around in your refrigerator. There's some milk, some eggs,
chicken, bread, cheese, mashed potatoes .. You look in the kitchen cupboards and there's flour, rice, spices ..

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!

How do you go about it?


Requirements
NVP - Minimal Viable Product

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

Ingridient - id - name - measurement unit

User - id - name - phone number

Kitchen - id - name

Kitchen * - * Ingridients - quantity

User * - * Kitchen

Ingridient * - * Recipe - quantity

Recipe Table recipe_id, name, ttp, instructions, source

Ingridient Table ingridient_id, ...

Recipe_Ingridients Table recipe_id, ingridient_id, amount (fk) (fk) ---(pk)-----------------

Ingridient User Kitchen

Enum for the category -> stored in the DB Want a class hierarchy for the categories

interface RecipeRecommedationStrategy {
List<Recipe> recommend(Kitchen);
}

class MoodBasedRS implements RecipeRecommedationStrategy {}

class SeasonBasedRS implements RecipeRecommedationStrategy{}

class FestivalBasedRS implements RecipeRecommedationStrategy{}

class RecommendIncomplementRecipeStrategy implements RecipeRecommedationStrategy {}

class RecipeRecommendationService {
private RecipeRecommedationStrategy recipeRecommedationStrategy;

List<Recipe> recommend(Kitchen) {
// use my strat to recommend
}
}

You're hungry again!


You used some of your ingredients for the previous meal. You now have no eggs or bread or chicken remaining. Your app
isn't able to suggest anything exciting for you to eat.

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?

Word gets out..


Your friends love the app, and tell their friends about it. Your coworkers love the idea so much that your company decides to
use your app for planning out their lunch and dinner menus! It seems that thousands of users would like to use your app. You
envision a cool new startup around it, but you need to figure out some features to make your app more useful and viral. Also,
you need a business model to ensure that your app is a success. Ideas?

1. Suggest features

suggesting many features =/= you're doing good


each feature that you suggest should have a reason behind it
pick the low hanging fruits first
feature like picnic support - nice feature - complex to implement
share your food pic on facebook

2. Suggest business model

in-app advertisements (usually the worst way of monetizing)


paid users get extra functionality (works for some apps)
partnerships - suggest a recipe that you don't have all the ingridients for - redirect the user to buy the ingridients
from a partner provider.
cooking classes/video
rent a cook

3. Suggest architecture - HLD cloud = someone else's computer

80-20 principle

20% of your effort will give you 80% of your results.


80% of your effort will give you 20% of your results.

Scaler has a 1-1 mock interview feature.

What changes are good and what are bad.

Okay

1. adding a new column to a table is fine


2. adding a new attribute to a class is fine
3. adding a new class/interface is fine
4. subclassing something is fine
5. adding a new service is fine
6. adding a new database is fine

Bad

1. Changing a class to add new functionality


2. Modifying the relationships b/w your existing tables
3. Destroying a table
4. not being able to turn features on/off without code resubmission

It is better that to add new functionality, you create a new subclass.

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

UndoableTTTGameService extends GameService {

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

HTML+CSS+JS - 3-4 classes ~1 month of Project

1 the actual scores of players -> definitely have to store this

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!

You might also like