Steps for Developing


5 tips to solve any System Design question

 

Let's start with a few best practices to help you structure your answer. This will also help you avoid mistakes that trip up even the most skilled devs.

 

1) State your assumptions

Start by listing all required features of the system, common problems you expect to encounter with this sort of system, and the traffic you expect the system to handle.

 

The listing process lets the interviewer see your planning skills and correct any possible misunderstandings before you begin the solution.

 

2) Ask your interviewer follow-up questions

Most System Design questions are purposefully vague. Ask clarifying questions to hone in on the requirements and demonstrate your knowledge of the system’s needs.

 

3) Narrate trade-offs

Every design choice matters. There is never a "perfect" solution that optimizes for every requirement. At each decision point, list at least one positive and one negative effect of that choice.

 

4) Discuss emerging technologies

Conclude each question with an overview of how and where the system could benefit from machine learning, or other emerging tech. This will demonstrate that you’re not just prepared for current solutions but future contingencies as well.

 

5) Study your architectures

Most modern services are built upon a flexible microservice architecture. Unlike the monolithic architectures of tech companies in the past, microservices allow smaller, agile teams to build independently from the larger system.

 

Some older companies will have legacy systems. However, microservices can function in parallel to legacy code and help refresh the company architecture as a whole.


Case Study: Design a Messaging Service (e.g. WhatsApp)

 

Let's put these tips to the test in a real-world case study.

 

Variations of this question are very popular across the industry. The specific wording may vary (e.g. "Design WhatsApp" or "Design Facebook Messenger"), but the objective is the same — you will have to design a messaging service, which will have a unique set of characteristics and requirements.

 

Essentially, you will design a service that allows users to chat with each other over the internet. Conversations can be one-on-one or can be group chats with many members. Messages should only be accessible by those included in the conversation.

 

A good place to start with any System Design Interview question is to review functional and non-functional requirements.

 

(NOTE: You can find a much more detailed, step-by-step breakdown of Design WhatsApp in our popular course: Grokking Modern System Design Interview for Engineers & Managers).

 

Requirements

 

Functional requirements

Non-functional requirements


High-level Design

 

The high-level design for a messenger application is fairly simple. A user contacts a chat server and sends a message. The chat server relays the message to the user it was intended for, and then stores the message in a database. Once the message is delivered, the server notifies the sender that the message was successfully transmitted.




The following steps describe the communication between both clients:

 

WhatsApp APIs

WhatsApp in particular offers a large quantity of features via APIs. It is a good idea to brush up on essential APIs calls, including:

(For a detailed breakdown of WhatsApp's high-level and API design, check out our course: Grokking Modern System Design Interview for Engineers & Managers)

 

Key Tradeoffs

In every System Design problem, there are important trade-offs that you will have to make and justify to your interviewer. There are two particular tradeoffs you will want to account for in this particular design:

 

1) Consistency vs. Availability

According to CAP theorem, a system can either ensure consistency or availability during network disruptions. For an application like WhatsApp, where the sequence of messages is vital, consistency must take precedence over availability.

 

2) Latency vs. Security

While users value a real-time experience through low latency, security remains paramount, especially for platforms like WhatsApp. The dilemma arises when attempting to securely transmit messages, especially multimedia. Encrypting such data can introduce significant delays (as depicted in the illustration below), necessitating an intentional balance between quick responses and robust security measures.




  

Detailed Design Questions to Prepare For

 

Tools & Strategies to Consider


Grokking Modern System Design Interviews

 

I hope this quick case study was helpful!

 

For a much more in-depth breakdown of Design WhatsApp, along with 12 other popular design questions (including Design Uber, YouTube, and Facebook Newsfeed), I highly recommend our best-selling course: Grokking Modern System Design Interview for Engineers & Managers.

 

You'll learn System Design fundamentals that will set you up for success in your interviews and beyond. Give it a try and let me know what you think.