System Design · Module 1 · Lesson 1 of 4 · 30 min
What System Design Is and What You Must Explain
Learn what a design answer contains, distinguish high-level from low-level design, and connect every box to a real request.
01 The idea
The problem this lesson solves
A reader requests /r/a7. The service must either return the stored destination or a documented missing result.
Start here with basic programming and arithmetic.
02 Worked example
Follow one worked example
Trace the example in order. Follow the same identities, units and state transitions through the diagram and the events below.
A useful design explains who requests what, where the authoritative state lives, and how the request can fail.
03 The method
Mechanisms decisions and a guided tutorial
Work through the explanation in order, then apply it in the tutorial. Each comparison names a cost as well as a benefit.
| Choice or concept | Purpose | Boundary or cost |
|---|---|---|
| Client | Requests a redirect | Does not decide whether a code exists |
| Application | Validates and responds | Must distinguish missing from unavailable |
| Database | Persists mappings | Needs a recovery and capacity plan |
Clarify the kind of design
High-level design describes services, data stores, request paths and failure behavior. Low-level design describes classes, interfaces, state transitions and implementation details inside a component. ‘Design a parking lot’ can mean either. Ask what artifact is expected before choosing a level. The short-link service here is a high-level exercise: explain the components, request paths and durable mapping before specifying implementation classes.
Start with one user action
A student opens a short link. The product behavior is small: find the stored destination and send a redirect. Begin by naming the client, the request, the stored mapping and the response. You can now draw client → application → database without choosing a cloud provider.
Follow one code through the drawing. The client sends a7. The application looks up a7, receives its destination, and returns a redirect. The database is authoritative because the service must recover the same mapping after an application restart. Each arrow has a payload and each component has a reason to exist. This is already a design, even though it has only three boxes.
Decisions are more valuable than product names
Compare two explanations: “we use a distributed database” and “one database currently meets measured demand; we will add read capacity when query latency exceeds the target under the expected peak.” The second tells a reviewer how to evaluate the choice. A technology name is useful only after you state the behavior you need from it.
Ask four questions at each box: what does it receive, what does it return, what state does it own, and what happens when it times out? These questions expose missing contracts. An arrow labeled “data” hides whether the call is a lookup, a write, an event or a bulk transfer. Use an operation name and one sample payload instead.
Choose the expected artifact
For a single-process link encoder, low-level design might define a repository interface, a code generator and error handling. For the public service, high-level design adds authentication, deployment, storage ownership and failure boundaries. Both need good reasoning, but the deliverables differ.
Practice explaining a three-box design in ninety seconds. State its scope, trace one successful request and one missing-code request, then name its first limit. Do not add queues or shards merely to fill the drawing. Expand the model only when another requirement makes a new responsibility necessary.
Guided tutorial
1. Write the contract
Describe a successful redirect and a missing-code response in two sentences.
2. Draw three boxes
Label every arrow with the actual value or operation it carries.
3. Cross out a component
Remove the app, then the database, and describe the user-visible failure in each case.
4. Change the artifact
Now specify the classes you would implement for an in-process repository; identify what belongs to LLD.
client → GET /r/a7 → application
application → find_by_code("a7") → database
database → destination or missing → application
application → redirect or documented error → client04 Cheat sheet
Review the decisions
Use this table to explain the mechanism and its limit without memorizing a product name.
| Choice or concept | Remember | Check |
|---|---|---|
| Client | Requests a redirect | Does not decide whether a code exists |
| Application | Validates and responds | Must distinguish missing from unavailable |
| Database | Persists mappings | Needs a recovery and capacity plan |
05 Where & why
Check the primary references
Use official references for protocol and implementation details. The questions here are teaching prompts.
06 Interview questions
Explain the reasoning out loud
Answer before opening the explanation. The questions progress from vocabulary to decisions and failure behavior.
What does Component mean?
What does HLD mean?
What does LLD mean?
What makes a box-and-arrow drawing a design?
Why not choose the database first?
Can a small design be a good answer?
What is the first failure to trace?
How do you choose the level of detail?
07 Practice problems
Practice a new case
Solve the new cases before revealing hints. Complete worked solutions follow the set.
Identify responsibility
EasyShow the hint
Name the artifact
EasyShow the hint
Trace absence
MediumShow the hint
Remove a box
MediumShow the hint
Describe the arrows
MediumShow the hint
Defend a minimal design
HardShow the hint
Worked solutions
1. Identify responsibility
The client collects input; the API validates and authorizes; the database durably stores the note. The API must derive identity from authentication rather than trust an owner supplied by the client.
2. Name the artifact
One controller needs states, events and interfaces. A fleet service needs device identity, APIs, telemetry storage and behavior when devices disconnect.
3. Trace absence
A timeout does not prove absence. Return a documented unavailable response with a bounded retry policy; report missing only when an authoritative lookup succeeds and finds no accessible record.
4. Remove a box
The rate alone does not justify a cache. Measure latency and database capacity first; a cache introduces freshness, memory and recovery obligations.
5. Describe the arrows
The client sends image id p1 to the API; the API requests p1 metadata from the store; the store returns metadata or absence; the API returns the authorized representation or documented error.
6. Defend a minimal design
Use a client, an authenticated API and durable message storage. State ordering, retention and posting permissions. Initial limits might be database read capacity and one-instance availability; add complexity only when the targets require it.