The 5-step execution flow
easy 45 minA fixed order for the 45 minutes of a low-level design round: ask, name, sketch, build, prove.
Video lesson · Chapter 1 of 6
Make a prediction
0:00 / 4:38
See it run
The plan, the calls it leads to, the trace and the extension.
Operations
The plan
Five steps, each hands something on.
Step 1 of 5
Ask
| Minutes | Hands on | |
|---|---|---|
| 1 Ask | 0 to 5 | requirements |
| 2 Name | ||
| 3 Sketch | ||
| 4 Build | ||
| 5 Prove |
Five to seven lines that both agree on.
Step 1: Ask
- Good for
- Every round
- Costs
- A visible clock
Write the five end times at the edge of the board before you start.
In the real world
The same the 5-step execution flow doing real jobs. Pick one and step through it.
Seven minutes behind, and still a good end.
Step 1 of 5
Too many questions
| Plan | Really | |
|---|---|---|
| Ask ends | minute 5 | minute 12 |
| Name ends | ||
| Sketch ends | ||
| Build ends | ||
| Prove ends |
Ask ends at 12. Seven minutes late.
Step 1: Too many questions
Common mistakes
The bugs interviewers watch for, with the fix beside each.
State in a timer thread
majorIt races with empty and makes tests slow.
WrongThread(target=lambda: (sleep(1800), set_done())).start()Rightreturn RUNNING if now < wash.ends_at else DONECount outside the lock
criticalTwo taps both see one machine in use.
Wrongif held(who) < 2: with lock: machine.start(who)Rightwith lock: if held(who) >= 2: raise Refused() machine.start(who)Reading the clock twice
minorTwo rules of one call see two times.
Wrongrule.check(clock())machine.start(who, 30, clock())Rightnow = clock()rule.check(now)machine.start(who, 30, now)A test that cannot fail
majorIf nothing is raised, it passes.
Wrongtry: room.start("lee", "m1", QUICK)except Refused: passRightassert refused(lambda: room.start("lee", "m1", QUICK))
Interview tips
Show the clock
- Write five end times
- Say where you are
- Late: cut aloud
End each step
- A result to look at
- One exit line
- Wait for a nod
Core first
- The method where rules meet
- Refusals, then change
- Time passed in
Leave well
- What works
- What is left out
- What comes next