Part 9 of 9 · 4 min read
Exercises
Easy
Easy 1: Design or code? (15 minutes)
Sort these six decisions into "design choice" or "code choice": (a) saving orders in a database or in a text file, (b) naming a variable total, (c) sending emails right away or through a queue, (d) using a for loop or a while loop, (e) running one server or three, (f) the colour of a button.
Done when: all six are sorted, and each has one sentence saying whether it is easy or costly to change later.
Hint
Ask, "If this were wrong, would I fix one line, or rework many parts?"
Easy 2: Name the parts (15 minutes)
A school library app lets students search for books, reserve a book and get a reminder when it is due. List the client, the server, the data store, and say where a cache and a queue could help.
Done when: each of the five parts is named for this app, with one sentence about its job.
Hint
The data store is whatever must survive a restart. The queue is whatever can wait.
Easy 3: Say the trade-off (20 minutes)
For each choice, write what is gained and what is lost: (a) keeping a copy of the home page in a cache, (b) saving every order to disk before replying, (c) running two servers instead of one.
Done when: three answers, each with exactly one gain and one loss.
Hint
Write "gains ..., loses ..." for each one, using one short phrase each.
Medium
Medium 1: Redo the number (25 minutes)
The bakery grows to 50,000 orders a day. Work out the average orders each second, then the busy-time rate at ten times the average. Assume one server handles 100 requests each second (a made-up figure).
Done when: both rates are written down, and one sentence says whether one server is still enough and why.
Hint
Divide by 86,400, then multiply by ten for busy time, then compare with the made-up limit.
Medium 2: Questions before boxes (25 minutes)
A family wants a shared to-do list app. Write six questions you would ask before drawing anything, then draw the first design with only the parts that answers justify.
Done when: six questions, one diagram with at most five boxes, and one line for each box saying why it is there.
Hint
Ask about features, number of users, growth and what must never be lost.
Medium 3: Spot the over-engineering (25 minutes)
A design for a school notice board with 300 readers has 12 servers, 3 caches, a queue between every pair of parts and servers in two countries. Explain what is more than needed and propose a smaller design.
Done when: at least three over-built parts are named, the smaller design is drawn, and one trade-off of the smaller design is stated.
Hint
Compare each part's job with the 300 readers. A part with no job is over-built.
Hard
Hard 1: The first five minutes (35 minutes)
The task is "design a photo-sharing app". Write what you would say out loud in the first five minutes: the questions you would ask, the assumptions (facts you treat as true until someone checks them) you would write down and the plan you would state before drawing.
Done when: at least five questions, three written assumptions, and a four-sentence plan that mentions numbers, a first design and a deep dive.
Hint
Questions first, then assumptions, then the plan. Do not draw until the plan is spoken.
Hard 2: The reason column (35 minutes)
Pick a system you use daily. Draw its likely design with five or more boxes. Next to each box, write the reason it is there and what would change your mind.
Done when: five or more boxes, each with a reason and a "this would change my mind if..." line. Mark clearly which parts are guesses.
Hint
If a reason is "everyone does it", the reason is weak. Find the real one, or mark the part as a guess.
Hard 3: Same system, two sizes (40 minutes)
Design the bakery shop at 2,000 orders a day and again at 2,000,000 orders a day. List what changes, what stays, and the first moment you would need each new part.
Done when: two diagrams, a table of three or more differences, and a sentence for each new part stating the number that made it necessary.
Hint
Each new part needs a number that forced it, such as requests each second or lost orders per hour.