1. How to Approach a Design Question
The picture to keep in your head
Every question below is answered twice: first at the architect's desk, so you can picture it, then in the interview, so you know exactly what to do. Each answer ends with a memory code to lock it in.
The picture to keep in your head
A family walks into an architect's office and says, "Build us a house." A bad architect starts drawing right away. A good one puts the pencil down and asks: how many people live here? What's the budget? One floor or two? Any elderly parents who can't climb stairs? Only then does she size it, plan the doors, draw the floor plan, zoom into the tricky staircase, and walk the family through why every choice was made.
A system design interview is exactly this. The interviewer says "Design a URL shortener." Your job is to be the good architect.
Our running example: a URL shortener like bit.ly. You give it a long link, it gives you a short one, and anyone who clicks the short one lands on the long one. (You'll design it end to end in Chapter 31. Here we only use it to practise the approach.)
| At the architect's desk | In the interview |
|---|---|
| The family's wish: "build us a house" | The prompt: "design a URL shortener" |
| Asking who lives here, budget, floors | Clarifying questions, requirements |
| 4 people or 400? | Estimates: users, requests per second, storage |
| Doors and what passes through them | The API |
| The store room and what's kept in it | The data model |
| The floor plan | The high-level design |
| Zooming into the tricky staircase | The deep dive |
| Walking the family through each choice | Trade-offs and wrap-up |
Figure: the architect's process, mapped step by step to the interview. Nobody draws before they know who the building is for.