Requirements and Trade-offs
Overview
Before drawing any boxes, a good designer asks what the system must do and how well it must do it. Because you can never have everything at once, design is mostly about choosing sensible trade-offs and explaining them.
Detailed Notes
What are requirements
Requirements are the things the system must satisfy. They come in two kinds.
Functional requirements say what the system does. They are features:
- "Users can post a photo."
- "Users can follow other users."
- "The app shows a feed of recent posts."
Non-functional requirements say how well it must do it. They are qualities:
- Latency: how long one request takes, from sending to receiving the answer. "The feed must load in under 300 ms."
- Throughput: how many requests the system handles per second.
- Availability: the share of time the system is up and working. "99.9% of the time."
- Scalability: whether it can keep working well as users and data grow.
- Durability: saved data is never lost.
- Consistency: everyone sees the same, up-to-date data.
Each of these is explored in detail in later chapters. For now, just know the names.
The problem it solves
Without requirements you build the wrong thing. A chat app for 50 friends and a chat app for 500 million people have the same features, but completely different designs. Two apps with the same functional requirements can need very different architectures because their non-functional requirements differ.
Asking questions first also saves time: you avoid building an expensive system you never needed.
How it works: trade-offs
You rarely get every quality at once. Improving one often costs another. These pairs come up again and again:
- Speed vs freshness: keeping a saved copy of an answer makes responses faster, but the copy may be slightly out of date.
- Consistency vs availability: insisting that everyone sees identical data can mean refusing to answer when parts of the system cannot talk to each other.
- Simplicity vs scale: a simple design is easy to build and fix, a highly scalable one has more parts that can break.
- Cost vs reliability: extra copies of everything make you safer but cost more money.
A trade-off is a deliberate choice: "We accept X because we need Y." Saying that sentence out loud is a big part of a good design answer.
A simple example
Suppose you run a shop's website. You decide two requirements:
- Functional: customers browse products and place orders.
- Non-functional: product pages must be fast, and orders must never be lost.
These pull in different directions. For product pages, slightly old data is fine, so you can favour speed. For orders, losing one is unacceptable, so you favour safety even if it is a little slower. One system, two different choices, each justified by a requirement.
System design example
A simple step-by-step way to approach any design question, in an interview or at work:
- Clarify requirements: what features, how many users, what quality matters most?
- Estimate the scale: roughly how many requests and how much data? (A later chapter teaches quick estimation.)
- Sketch a simple design: client, server, database. Make it work first.
- Find the weak spot: what breaks first under load or failure?
- Improve and record the trade-off: fix that weak spot, and say what it costs.
- Repeat until the design meets the requirements.
Start simple and add pieces only when a requirement demands them. Adding things "just in case" makes systems harder to run without making them better.
Summary
- Functional requirements are features; non-functional requirements are qualities like latency, throughput and availability.
- Different requirements lead to different designs, even for the same features.
- Qualities pull against each other, so every design involves trade-offs.
- Start with the simplest working design, find the weakest point, improve it, and say what it costs.
Architecture Diagram
Requirements drive a simple design, which is then improved step by step.
- 1Clarify what the system must do and how well.
- 2Estimate users, requests and data size.
- 3Draw the simplest design that works.
- 4Find what breaks first, fix it, and note the trade-off.
Common Interview Questions
Chapter quiz
Introduction to System Design · 5 questions
1.In a web app, what does a server do?
2.Why is a single server a risk for a growing product?
3.Which of these is a non-functional requirement?
4.What does latency measure?
5.What is a good way to start a system design answer?
0 of 5 answered
Finished this lesson?
0 of 91 lessons done · 0% of the course

