System Design

T2

Demos

Pick an exercise and step through its 45-minute build. Watch the clock and the grader. Then step into the production version, part by part, with the talk line beside each change.

Not startedSaved in this browser only.
  1. 1Each build plays as checkpoints. Every checkpoint is real source: the final code with the later parts left out.
  2. 2Every checkpoint was compiled, its tests were run, and its server was graded. The bars are results, not estimates.
  3. 3The clock is arithmetic: typed characters at 500 a minute, against 20 minutes of typing.
  4. 4After the build, each production part sits beside the talk line that explains it.
T2
    A

    The player

    pick an exercise, then step through

    Loading the build.

    The code view leaves out each file's package line and imports. The clock counts the package line, and an editor adds the imports.

    I have a running server before 15 minutes of typing. After that, I add one feature and its test at a time.

    B

    The nine builds

    from the recorded runs
    exercisetyping clockfirst server atall checks pass atchecks at first servercheckpointstyped characters
    E1 Key-value store with nested transactions18:1911:2915:5314 of 3099,162
    E2 Driver delivery payments19:5713:4618:2920 of 36109,976
    E3 Music player analytics17:0011:2315:1722 of 3588,501
    E4 Expense rules engine19:5214:1017:3525 of 3299,935
    E5 Travel expense calculation19:4814:4015:235 of 4489,900
    E6 Room booking with holds19:5213:4114:504 of 3689,936
    E7 Wallet transfers19:5713:3618:248 of 2999,978
    E8 Job queue with leases19:4613:3517:0520 of 3389,883
    E9 Directory and audit log19:5914:5315:4512 of 3389,995

    All nine builds fit the 20 minutes of typing. The first server comes after most of the logic, because each build works from the bottom up.

    C

    What each checkpoint proves

    measured on every run
    claimhow we knowstatus
    The code is the real buildEvery line belongs to one checkpoint. The last checkpoint equals the files, byte for byte.Tested
    Each checkpoint compilesThe Go compiler builds each one in an empty module.Tested
    Your tests passThe tests typed so far run at each checkpoint, and all pass.Tested
    The grader barsThe real main.go starts, and the grader calls it over HTTP. A check that passes at one checkpoint passes at every later one.Tested
    The production diff and the talk linesA test reads them from the exercise sheet, and it fails if the two differ.Same data
    The clockTyped characters at 500 a minute, by the rule on each exercise sheet.Arithmetic only

    Each result here comes from a real run. If the code changes, the run fails until the recording is made again.

    D

    What was not measured

    read the player with these in mind
    not measuredwhat that means
    A person building thisNo one was timed. The clock is a count of characters and not a stopwatch.
    Reading and thinkingThe clock stops at typing. It has no time for the spec, for mistakes, or for runs of the grader.
    First draftsEach checkpoint is the final code with parts left out. In the room, your early code can be simpler.
    Races at a checkpointThe checkpoints run without the race detector. The whole build runs with it in its own tests.
    The production code hereThe player shows the diff and does not run it. Each exercise has its own production tests.
    CommitsEach checkpoint is the state one commit would hold. No saved history of commits exists.

    The clock counts typing and nothing else. I plan the other 25 minutes for reading, thinking and debugging.

    E

    How to read the bars

    three patterns
    you seeit means
    Some checks pass before their feature existsA route that does not exist answers 404. At checkpoint 5 of E1, "an unknown transaction is 404" passes with no commit route.
    A bar stays flat at a test checkpointA test adds no server code. The bars move only when the server changes.
    One checkpoint moves most of the barsThe logic was typed earlier, and one route exposes it. The service and the store do not show until a route calls them.

    A green check is evidence about one behaviour. I read which checks moved, and not only how many.

    F

    How to rehearse

    one exercise, one sitting
    stepdo this
    1Read the spec on the exercise sheet. Do not open the player yet.
    2Build it with a 45-minute timer. Commit at each working step.
    3Run the grader at each commit, and write down your time.
    4Step through the player. Compare your order and your first server time.
    5Step into production. Say each talk line out loud, without reading it.

    I rehearse alone first and watch the player after. The gap between my order and the player's order is what I study.

    G

    Drill

    predict, then reveal

    0 of 7 known

    1. You type a test, and the grader bars do not move. Why not?

    2. In E1, "an unknown transaction is 404" passes at checkpoint 5, before the commit route exists. Is that a bug?

    3. Why do the first checkpoints show no grader result?

    4. The clock shows 11:29 at the first server in E1. Will you be there at 11:29 in the room?

    5. The E1 store at checkpoint 1 already compares read versions. The E1 sheet adds version checks at 45 minutes. Which is right?

    6. A function in a build is renamed. What stops this page from showing the old name?

    7. Why does the order go store, service, routes, and not one route at a time from the top?

    H

    Numbers to say

    from the recorded runs
    budget
    20 minutes of typing at 500 characters a minute.
    typing
    17:00 to 19:59 across the nine builds.
    first server
    11:23 to 14:53 of typing.
    all checks
    14:50 to 18:29 of typing.
    coverage
    77 checkpoints and 308 grader checks.

    Typing arithmetic from the files, not a measurement of a person. Grader results come from real runs.