Book Deep-Read · A Philosophy of Software Design · Chapter 11

Design it Twice

A Philosophy of Software Design · Ch 11 · Design it Twice · Ousterhout · 2nd ed 2021

中文 →

What is this chapter about?

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.

A strange observation first

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.

Why the old way is 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.

How it works, intuitively

What it buys you / how to choose

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.

One line to remember

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