Scoping Out Loud
A clarifying question is worth asking when its answer changes what you draw. The test takes one breath: name two possible answers, and say what you would draw differently for each. If nothing changes, the question fills time.
This lesson takes the chapter's practice question, "Design the comments under the articles of a news site", and scopes it in the minutes Scope has: the questions, the two lists of requirements, what is left out, and the agreement that comes before the first box. The next two lessons carry the same question on to its estimates and its data.
A Question Earns Its Place
Apply the test to the practice question. Ask how many times each comment is read, and the two answers draw differently. Read once or twice, every read can go to the store and nothing more is needed. Read thirty times, the reads are the design's main load, and the read path gets built before anything else. Ask which language the service is written in, and either answer leaves the board exactly as it was.
The interviewer notices how many of your questions were the first kind. A few questions that each moved the design say more than a long list that moved nothing, and they leave the minutes for the drawing.
The Questions That Usually Change a Design
The questions that earn their place mostly fall into five families. Each family moves a known decision, and each decision has a block in this course that owns the mechanism.
- Scale and shape: how many writes, and how many reads for each write. The answer moves the read path, and with it whether the design needs a cache (Chapter 2).
- Freshness: how soon a new comment must appear to other readers. The answer moves how long a cache may hold an entry and whether a read may come from a lagging replica (Chapter 2, lessons 2 and 4).
- Retention: how long the data is kept. The answer moves the storage total and how many partitions it needs (Chapter 3).
- Who and where: which regions and which devices the readers use. The answer moves whether the design spans more than one region (Chapter 6, lesson 5).
- What a failure costs: whether a lost write is worse than a late one. The answer moves how many copies a write waits for and how messages are delivered (Chapters 4 and 6).
For the practice question, this chapter takes the answers below as agreed. Assume 20 million new comments a day, each read about 30 times, kept for 3 years, at about a kilobyte each. Comments are shown newest first, a page at a time. A new comment is visible to other readers within a few seconds, and a moderator's delete takes effect within a minute.
Requirements in Two Lists
The functional list holds the verbs a user performs, two to four of them. Here there are three: post a comment on an article, read an article's comments, and delete a comment.
The non-functional list starts as adjectives, and each one has to become a number or a named read before it can decide anything. "Available" becomes a count of nines. 99.9 percent allows about 44 minutes down a month, and 99.99 percent allows a little over 4. The arithmetic of nines, and what each extra nine costs, is the last lesson of Chapter 6.
"Consistent" becomes the one read that must never be stale, or a bound on how stale each read may be. Here no read has to be perfectly fresh: a new comment may take a few seconds to appear, and a delete may take up to a minute, and both bounds are now part of the agreement. Chapter 4's third lesson names the models behind sentences like these. "Fast" becomes the call that has to be fast, which here is listing an article's comments, because every one of the thirty reads goes through it.
Out of Scope, Said Out Loud
Name two or three things you are leaving out, as a sentence, so that the interviewer can object while it is cheap.
For the practice question, three things go: spam detection, notifications when someone replies, and ranking comments by votes. Notifications are a problem of their own, in Chapter 15. You might say: "I'll leave spam filtering and reply notifications out, unless you want one of them in."
Agreeing Before Drawing
Before the first box, read the agreed requirements back in one breath, and wait. The interviewer accepts them or corrects one, and a correction now costs a sentence. The read-back can sound like this: "So that's post, list newest first, and delete, at twenty million comments a day read thirty times each, with deletes live within a minute. Does that match what you had in mind?"
When the interviewer answers "you decide", decide out loud. State the value as an assumption, with a round number and the word itself: "assume 30 reads per comment". Then move on. The agreed number is now one of the design's reasons, and the next lesson turns it into a decision.
Asking hands the interviewer a choice they may care about. Ask when the answer moves the design and the interviewer may have a view: the read ratio, the retention, the freshness.
Assuming keeps the clock moving. Assume, out loud and with a round number, when the interviewer has declined to answer or when the value only sets a size, and say which decision would move if the number were different.
- "More questions show more care." Questions that move nothing cost minutes the deep dives need, and the interviewer notes which questions mattered.
- "Non-functional requirements are adjectives." Highly available decides nothing until it is a number of nines or a named failure the system survives.
- "Out of scope means unimportant." It means not in these 45 minutes. Saying it lets the interviewer pull a part back in before the design depends on its absence.
- "The interviewer will object if a requirement is wrong." Many let a wrong assumption stand and ask about it at minute 30, when it is expensive. The read-back is where it is cheap.
- "Scope is only questions." Scope ends with agreed requirements, numbers and an API. A list of questions with no agreement leaves the first design with nothing to answer.
- Ask the question that sets the read path first, before any question about features.
- Turn every non-functional requirement into a number or a named read before you draw.
- Say out loud what you are leaving out, as one sentence.
- Read the agreed requirements back before the first box, and state any value you assumed with the word "assume".
Knowledge Check
For the news-site comments, which question's answer changes the design the most?
- Which web framework the article pages are already built with
- Roughly how many times each comment is read after it is posted
- Which team inside the company will be on call for the service
- Whether the comment box allows bold and italic formatting
The interviewer says the comments must be highly available. What turns that into a requirement?
- Running two copies of every service, in more than one zone
- A promise that the service never goes down for any reason
- A number of nines, such as 99.9 percent, about 44 minutes a month
- A cache in front of the store, so reads survive a store outage
Which of these is safest to rule out of scope for the comments question?
- Listing an article's comments newest first, a page at a time
- Letting a moderator's delete take effect within a minute
- Notifying a user when someone replies to one of their comments
- Keeping the comments for the three years agreed in Scope
When is it right to assume a value out loud instead of asking for it?
- When the question feels too basic to ask a senior interviewer
- When the value decides the read path and the interviewer may have a view
- When the interviewer declined to answer, or the value only sets a size
- Never, since an assumed value is a guess the interviewer marks down
What must Scope have produced before the first box is drawn?
- Agreed requirements, the numbers that decide, and an API
- A full list of every question the interviewer might expect
- A choice of database product and cloud provider for the design
- A rough sketch of the final design, to check that it all fits
You got correct