architect-handbook

Software Architect Handbook

View on GitHub

A Framework for System Design Interviews


The Interview

System design problems are open-ended, and there is no perfect answer. They simulate real-life problem solving where two co-workers collaborate on an ambiguous problem and come up with a solution that meets their goals. The final design is less important compared to the work you put in the design process. This allows you to demonstrate your design skill, defend your design choices, and respond to feedback in a constructive manner.

An efective system design interview gives strong signals about a person’s ability to collaborate, to work under pressure, and to resolve ambiguity constructively. The ability to ask good questions is also an essential skill, and many interviewers specifically look for this skill.

A good interviewer also looks for red flags. Over-engineering is a real disease of many engineers as they delight in design purity and ignore tradeoffs. They are often unaware of the compounding costs of over-engineered systems, and many companies pay a high price for that ignorance. Other red flags include narrow mindedness, stubbornnesss, etc.


4-step process

  1. Understand the problem and establish design scope
  2. Propose high-level design and get buy-in

1. Understand the problem and establish design scope (3 - 10 minutes)

Think deeply and ask questions to clarify requirements and assumptions. When you ask a question, the interviewer either answers your question directly or asks you to make your assumptions. If the latter happens, write down your assumptions.

One of the most important skills as an engineer is to ask the right questions, make the proper assumptions, and gather all the information needed to build a system.

Example

If you are asking to design a news feed system, you want to ask questions that help you clarify the requirements. The conversation between you and the interviewer might look like this:

Candidate: Is this a mobile app? Or a web app? Or both? Interviewer: Both.

Candidate: What are the most important features for the product? Interviewer: Ability to make a post and see friends’ news feed.

Candidate: Is the news feed sorted in reverse chronological order or a particular order? The particular order means each post is given a different weight. For instance, posts from your close friends are more important than posts from a group. Interviewer: To keep things simple, let us assume the feed is sorted by reverse chronological order.

Candidate: How many friends can a user have? Interviewer: 5000

Candidate: What is the traffic volume? Interviewer: 10 million daily active users (DAU)

Candidate: Can feed contain images, videos, or just text? Interviewer: It can contain media files, including both images and videos.

2. Propose high-level design and get buy-in (10 - 15 minutes)

In this step, we aim to develop a high-level design and reach an agreement with the interviewer on the design. It is a great idea to collaborate with the interviewer during the process.

If possible, go through a few concrete use cases. This will help you frame the high-level design.

Example

Let’s use “Design a news feed system” to demonstrate how to approach the high-level design.

At the high level, the design is divided into two flows:

3. Design deep dive (10 - 25 minutes)

At this step, you and your interviewer should have already achieved the following objectives:

You should identify and prioritize components in the architecture. Every interview is different. For URL shortener, it is interesting to dive into the hash function design that converts a long URL to a short one. For a chart system, how to reduce latency and how to support online/offline status are two interesting topics.

Example

Extending on the news feed system example, we’ll investigate two of the most important use cases:

  1. Feed publishing

  1. News feed retrieval

Step 4 - Wrap up (3 - 5 minutes)

In this final step, you might get asked a few follow-up questions or get the freedom to discuss other additional points. Here are a few directions to follow:


Do’s and Don’ts

Do’s

Don’ts