How to Solve Design Questions
Take 5 min of time and figure out all possible use cases of the problem given to you.
Step 1: Use Cases
- How, when data will be added?
- How data will be updated/ edited?
- How data will be deleted or expired?
- Request will come from api or UI?
- Is data statistics required?
- Ofcourse Highly Availablity is mandatory
Step 2: Constraints: The most typical thing to consider is:
1. The amount of traffic a System need to handle: How many/frequency read or write operations. This should be turn down to request per second after doing all calculation
2. The amount of data System need to handle
Step 3: Abstract Design: HLD (High Level Design)
Obviously, we will some sort of idea here that what all Data structure or sort of software component you will be using to design this system.
Kick Ass Joke on How to draw Abstract Design
After marriage fixes specially in india, We know that who(Uncle, brother, neighbour) is going to do what work. Like :
Who will book Marriage Hall
Who will get card printed
Who will take care of Catering bla.. blaa… blaa
Just put down all your component togather and draw a diagram.
Technical Aspect
What all Data Structure component you will use and how and what data will be kept where like:
- HashMap or Linked HashMap, ArrayList, Kafka, RabitMQ, Cassandara
- What all things will come in Keys and values
- For permanent what we will do etc etc etc………
Low Level Design: Here we can start defining class models, DB Design and few driver classes as time permits OR some time actual code.
Step 4: Concurrency: Discuss how will you handle concurrency in your Design what you have discussed in above approach. Make the changes in your system if required
Step 5: Scalability: Think if all of sudden your traffic no. of request per second gets increase then what can you do to accomodate it.