The five stages — the spine of every answer
One order to work in, so you never freeze in front of a blank whiteboard.
By devskills editorial team · Last updated
People freeze because the question is huge and there is no clear first move. The fix is to always use the same first move. These five stages are that move. It is a fixed order you use on every problem, so you are never deciding what to do next while someone watches you.
Stage 1 — Requirements. Say your assumptions out loud. Ask one or two questions that would change the design. Then suggest the scope yourself. The test for whether to ask something: would the answer change a box on the whiteboard? If it only changes a screen or a setting, assume it out loud and move on.
Stage 2 — Actors and lifecycle. Who touches this system? Include the system itself. Then write the life of the main thing as a chain of states, from start to end. Then do the part people skip: add the failure branches. At each state, ask two questions. What if this never finishes? What if one side quits here? A lifecycle with only the happy path is half a lifecycle. The missing half is where most of the design work is.
Stage 3 — Numbers. Estimate requests per second, storage, and bandwidth. Then say one sentence you must not skip: "so the hard part here is ___." If the numbers did not change your mind about anything, you either did the maths wrong or you ignored the answer.
Stage 4 — High-level design. Now, at last, boxes and arrows. Every box needs a reason from Stage 1 or Stage 3. A part that nobody asked for loses you points.
Stage 5 — Deep dive and trade-offs. Pick the two hardest parts and go deep on them. After every decision, say what it costs. Someone who picks a slightly worse option and names the cost scores higher than someone who picks the best option in silence.
Why each stage exists. Requirements: the question is deliberately vague, and every box you draw before this is a guess. Lifecycle: the happy path is the easy half, and the failure branches are where the design actually lives. Numbers: one part of the problem is hard and the rest is easy, and they look identical until you do the arithmetic. Design: by this point you have a reason for every box you are about to draw. Trade-offs: naming what a decision costs is one of the clearest signs of seniority.
What an interviewer is ticking off. Roughly one thing per stage, in order: that you stated your assumptions, that you named the failure branches, that the numbers changed your mind about something, that every box has a reason, and that every decision has a stated cost. When a problem adds checks of its own, its worked solution lists them in a stage checklist.
- Having a fixed first move is what stops you freezing.
- Stages 1 to 3 take about a third of the time. They make everything after them easy to defend.
- Every box in Stage 4 must point back to Stage 1 or Stage 3.
- Stage 5 is where senior level shows: say the cost of each decision, out loud.
The five stages on one problem: a URL shortener
The interviewer says "design a URL shortener" and stops talking. Here is what each stage sounds like on that one question, in the order you would say it. The numbers are assumptions you state out loud, not facts about any real service.
- 1Stage 1 — Requirements
Assume out loud: anyone can shorten a link, links never expire unless deleted, no accounts in the first version. Ask the one question that changes a box: "Do people need custom aliases?" If yes, you need a uniqueness check on user-chosen strings, which is a different write path from generated codes. Click analytics would be a separate box too, so ask whether it is in scope. A question like "what colour is the button?" changes no box, so you do not ask it.
- 2Stage 2 — Actors and lifecycle
Actors: the person creating a link, the many people clicking it, and the system itself, which generates codes. Lifecycle of a link: requested → code generated → stored → resolved on every click → maybe deleted. Now the failure branches. What if two creates generate the same code? What if the store write fails after the code was shown to the user? What if a link is deleted while a copy is still cached? Each of those becomes a design decision later.
- 3Stage 3 — Numbers
Assume 100 million new links a month: about 40 writes a second on average. Assume each link is clicked 100 times: about 4,000 reads a second, a 100:1 read-to-write ratio. Five years of links is 6 billion; at roughly 500 bytes each that is about 3 TB. Then the sentence you must not skip: "so the hard part is serving reads fast and cheaply, and generating codes that never collide. Writes are small."
- 4Stage 4 — High-level design
Every box points back to a stage. A write API that generates a code and stores it (Stage 1). A key-value store keyed by code, because every read is a single lookup by code (Stage 3). A cache in front of it, because reads outnumber writes 100 to 1 (Stage 3). A redirect service that looks up the code and answers with a 301 or 302. There is no analytics box, because Stage 1 left it out of scope.
- 5Stage 5 — Deep dive and trade-offs
Go deep on the two hard parts Stage 3 named. Code generation: a counter encoded in base 62 never collides, but the codes are guessable; random codes are not guessable, but need a collision check on every write. Say which you pick and what it costs. Redirect type: a 301 is cached by browsers, so repeat clicks never reach you, which is cheap but invisible to click counting; a 302 sends every click to you. If analytics comes back into scope, that choice flips.