Book Deep-Read · A Philosophy of Software Design · Chapter 11
A Philosophy of Software Design · Ch 11 · Design it Twice · Ousterhout · 2nd ed 2021
You're renovating your home, and the designer shows you exactly one floor plan: "This is it." You'd probably feel uneasy — only after seeing one or two very different plans would you know what's good or bad about this one. Software is the same. This chapter is about a single habit: when you make an important design decision, don't build the first idea that pops into your head. Force yourself to come up with a very different second option, and compare the two side by side.
The author taught at Stanford for years and noticed that the smartest students had the hardest time accepting this advice. All their lives, their first idea was good enough to earn top grades, so they got used to "think of it, then do it." But once problems get hard, the first idea stops being reliable. It's not that you aren't smart; the problems are genuinely hard.
With only one option, you have nothing to compare it to. You can't see its flaws because you don't know what else was possible. By the time the code is written and other people depend on it, discovering a poor choice is expensive to fix — like moving a wall after the house is built.
The extra hour or two is small next to the days or weeks of writing and fixing code that follow, and it often buys a clearly better design. With practice, you also get better at seeing what makes a design good. One honest cost: it pays off for big decisions that are hard to change; thinking twice about every tiny detail just becomes procrastination.
Your first idea is a starting point: come up with a very different one, compare, then decide.
Want to see how the book compares three interfaces for a text editor, which yardsticks to score them with, which levels of design this applies to, and how it connects to Rust RFCs, Python PEPs and architecture decision records? → Switch to Deep
You might think good design comes from inspiration — just land on a good idea. Ousterhout says your first idea is almost never the best one. Good design comes from comparison: for each major decision, come up with at least two radically different options, list the pros and cons of each, then choose or combine. It costs little time, yet improves design quality more than almost any single technique.
Chapter 11, one of the shortest in the book. Chapters 4–10 gave a series of criteria for what good design looks like (deep modules, information hiding, general-purpose interfaces, pulling complexity downward, defining errors out of existence). This chapter is about the process of getting to a good design: using those criteria to compare several candidates. The next chapter turns to comments. In practice it maps to design reviews, RFCs, and the "alternatives" section of architecture decision records (ADRs).
Designing software is hard, and the first idea that comes to mind is usually not the best one. The trouble with considering only one design is that you have no reference point, so you can't see its flaws. Discover them after it has become thousands of lines of code with dozens of callers depending on it, and the fix costs many times what it would have up front.
The author also names a human cause: really smart people find this principle hardest to embrace. Many strong students, he observes, got top grades all the way through on their first ideas and were never pushed to think of a second; that habit breaks down on hard problems. His point, roughly: if your first idea isn't good enough, it isn't because you aren't smart — it's because the problem is hard. And getting to work on problems that demand careful thought is a good thing.
The book returns to the graphical text editor from Chapter 6: design the interface for the class that manages a file's text. The author lists three candidates:
The point is that these three options differ a lot. The author advises deliberately picking approaches that are radically different from each other, because you learn the most that way; two variants that differ only in parameters reveal nothing essential. Even if you are sure there is only one reasonable approach, force yourself to come up with a second, however bad you think it is — thinking about its weaknesses and contrasting them with the first often exposes problems in the first one.
Each candidate only needs to be thought through far enough to compare, not down to implementation. Then list the pros and cons of each. For an interface, the author says the most important yardstick is how easy it is for higher-level code to use. In the text example, the line-oriented interface makes callers split and join lines for partial-line and multi-line operations like cutting and pasting the selection; the character-oriented interface forces callers to write loops for any change touching more than one character. The range-oriented interface — the general-purpose one Chapter 6 recommends — absorbs that work inside the class.
Other yardsticks: Is one interface simpler? Is one more general-purpose? Does one enable a more efficient implementation? These questions turn the earlier chapters' criteria — deep modules, generality, pulling complexity downward — into scoring items for the comparison.
Sometimes none of the candidates is attractive. That in itself is a useful signal: the specific problems the comparison exposed can be used directly to steer toward a new design — that is, come up with further candidates, typically by keeping each option's strengths while avoiding the weaknesses it revealed. Without a comparison you can't even say where the problems are, let alone fix them deliberately.
The principle holds at many levels of a system:
Designing it twice doesn't take much extra time. For a smaller module such as a class, the author estimates you may need no more than an hour or two to consider alternatives. Next to the days or weeks of implementation that follow, that's a small investment, and early design experiments are likely to yield a significantly better design. The longer-term payoff: repeatedly devising and comparing options teaches you which factors make designs better or worse, so over time your first idea gets better too.
Table 1 · Comparing the three text-class interfaces (the book's example)
| Candidate | What the caller must do | Fits | Main cost |
|---|---|---|---|
| Line-oriented | Split and join lines for partial- and multi-line operations | Adding / removing whole lines | Common operations like cut / paste of a selection get complex in callers |
| Character-oriented | Write loops for any change of more than one character | Typing single characters | Loops everywhere in callers; multi-character edits are verbose and error-prone |
| Range-oriented | One call handles any span of characters | Insert, delete, replace any range | The interface must be thought through more generally; the implementation is more complex (exactly where that cost belongs) |
Table 2 · What to compare at each level
| Level | Main yardstick | Typical effort | When it's worth it |
|---|---|---|---|
| Interface | Ease of use for callers; simplicity, generality | About an hour or two per class | Interfaces are hard to change once many callers depend on them — almost always |
| Implementation | Simplicity and performance | Usually less | Hot paths, choice of algorithms and data structures |
| Decomposition / UI | Module boundaries, information hiding, user experience | More, often as a design doc | Decisions spanning teams and years, where rework costs most |
One rule of thumb: how expensive will this decision be to change later? The more expensive (public interfaces, module boundaries, data formats), the more it deserves to be designed twice; local details you can change on a whim don't.
Many mature engineering communities have written "design it twice" into their process: proposal templates reserve a section for "what else was considered and why it wasn't chosen," so reviewers can check that the author really compared. In effect, they turn this chapter's personal habit into a team procedure.
Evidence and sources · publicly verifiable
① Your first idea is almost never the best; software design is hard, and a single option gives you no reference point.
② For each important decision, consider at least two candidates — radically different ones; the bigger the difference, the more you learn.
③ Even when sure there's only one way, force out a second and use its weaknesses to illuminate the first.
④ Sketch only, then list pros and cons; for interfaces, the key yardstick is ease of use for higher-level code.
⑤ Other yardsticks: simpler, more general, more efficient — the earlier chapters' criteria put to work.
⑥ Text-class example: line-oriented makes callers split and join lines, character-oriented makes them loop, range-oriented is easiest.
⑦ When none satisfies, use the problems the comparison exposed to build a new option.
⑧ It applies to interfaces, implementations (compare simplicity and performance), module decomposition, and user interfaces.
⑨ It's cheap — an hour or two per class — and pays back in better designs and better designers. Rust RFCs, PEPs and ADRs all institutionalize the "alternatives" section.