APOSD Reading Notes 01: It's All About Complexity

Notes on Chapter 1 of the second edition of A Philosophy of Software Design: why the greatest limit on writing software is our ability to understand it, the two ways to fight complexity, why design is never done, and how the author suggests reading the book.

Published
Reading time
49 min read
Category
Software design
Tags
Translated from
the Chinese original
Contents38 sections

A Philosophy of Software Design (APOSD for short) is a book on software design by John Ousterhout, based on his Stanford software design course CS 190. Ousterhout is a professor of computer science at Stanford, the creator of the Tcl language, one of the authors of the Raft consensus algorithm paper (with Diego Ongaro), and a member of the National Academy of Engineering. This series is my notes from reading the book chapter by chapter, based on the 2021 second edition1.

Chapter 1 is short—about 1,600 words—but it is the skeleton of the whole book’s argument: the later chapters answer the two questions raised here—what complexity is (Chapter 2) and how to reduce it (Chapter 3 onward).

Under each point, “From the book” is the book’s content, retold in my own words; English quotations are from the original. The rest—my reading, examples, and extensions—is my own addition.

The chapter in brief

Physical laws barely constrain software, so the biggest limit on writing it is how well we can understand the systems we ourselves create. As a program evolves, complexity keeps piling up and drags development down; there are two broad ways to counter it: make the code simpler, or pack the complexity into modules and hide it there. Because software is malleable, design is not a one-off phase but an ongoing activity that lasts the whole lifecycle. What this book sets out to do is offer a set of almost philosophical principles that let you compare options in a design space where no standard answer exists.

Everything in this chapter follows from that one judgment. Below I first give the line of argument, then go through it argument by argument.

The line of argument

Text
[Premise] Programming is one of the purest creative activities, unconstrained by physical laws
   │
   ▼
[Inference] So the biggest limit = how well we understand what we are building (a cognitive bottleneck)
   │
   ▼
[Phenomenon] Systems evolve → complexity accumulates → development slows → more bugs → slower and costlier (a vicious cycle)
   │        Bigger programs and bigger teams make it harder to manage
   ▼
[Diagnosis] Tools help, but only up to a point; the fundamental answer is to make the software itself simpler
   │
   ▼
[Prescription] Two paths: ① eliminate complexity (make code simpler and more obvious)
   │             ② encapsulate complexity (modular design)
   │
   ▼
[Process] Software is malleable → design is a continuous process throughout the lifecycle
   │        The waterfall model fails (frozen design → patching around problems → an explosion of complexity)
   │        Incremental development wins (design-implement-evaluate in small steps; fix problems while the system is still small)
   │
   ▼
[Conclusion] Software design is never done; developers should always be thinking about complexity
   │
   ▼
[This book] Goal 1: explain the nature of complexity
   │      Goal 2: give techniques for reducing complexity (no simple recipe, only principles)
   │
   ▼
[How to use it] Use it alongside code reviews; learn to recognize red flags; be moderate, don't go to extremes

Argument by argument

Point 1: Programming is one of the purest creative activities

From the book

The chapter begins by describing the writing of software as one of the purest forms of creative activity in human history: programmers are not held back by real-world constraints like the laws of physics, and they can build virtual worlds that are impossible in real life; nor does programming call for the physical skill that ballet or basketball demands—only creativity and the ability to put your ideas in clear order. Anyone who can visualize a system in their head can probably write it as a program. This brings us to the most crucial sentence in the whole chapter:

This means that the greatest limitation in writing software is our ability to understand the systems we are creating.

My reading

This premise looks merely rhetorical, but it actually determines the direction of the whole book. It can be unpacked into three layers:

  1. There is no external constraint forcing you to simplify. Architects are constrained by gravity, material strength, and budget, and those constraints in turn force the design to converge on a feasible solution. Programmers have no such external force—anything that can be expressed on a Turing machine can be written, including structures that are extremely obscure, self-contradictory, and fragile. Bad software is not eliminated by the physical world; it is painfully endured by the people who maintain it.
  2. The constraint therefore becomes internalized as a cognitive constraint. Since the outside world will not stop you, the only obstacle is the working memory of the human brain—how many relevant factors you can hold in your head at once. The essence of complexity is cognitive: it is not lines of code or branch counts, but “how many related things you must keep in your head at once when you change one place.”
  3. “If you can visualize it in your head, you can probably write it.” The converse also holds: if you can’t visualize it, you can’t write it. So the task of design is to lower the difficulty of visualizing—which explains exactly why the principles later in the book (deep modules, information hiding, consistency, obvious code) all serve “understandability.”

Additional examples

  • Can’t visualize it, so can’t get it right: race conditions in concurrent systems. You can understand every line of code, but you can hardly visualize “the system’s behavior over time” stably in your head, which is why concurrency bugs are among the most intractable. This also explains why languages like Go, Erlang, and Ada invented concurrency primitives such as channels, actors, and rendezvous—essentially encapsulating “invisible timing” into visible message flows, which is the “encapsulating complexity” this chapter describes.
  • A complementary view: in No Silver Bullet, Brooks distinguishes essential complexity (essence, inherent in the problem itself) from accidental complexity (accident, introduced by the tools and methods we choose). Ousterhout’s “understanding bottleneck” spans both: essential complexity determines how much you must understand at minimum, and accidental complexity determines how much extra you have to understand. The book does not use Brooks’s pair of concepts, but they help make sense of the two paths: eliminating complexity mainly attacks accidental complexity, while encapsulating complexity hides the rest—mostly the essential part—behind interfaces (see the comparison table under Point 4).

Critical boundary

“Unconstrained by physical laws” is rhetorical exaggeration. Software is in fact subject to many constraints that are not physical but just as hard: existing data, deployed systems, third-party APIs, team structure, legal compliance, hardware performance limits, network latency. They are not as explicit as gravity, but they will still “force” you to simplify—or, more commonly, force you to hold on without simplifying. This will come up again in Point 5, on malleability.

Point 2: Why complexity is inevitable

From the book

Programs keep gaining features as they evolve, and subtle dependencies spring up between their components. As complexity piles up over time, programmers who change the system find it ever harder to keep all the relevant factors in their heads; development slows down and bugs multiply, and the bugs then slow development further and drive up its cost. The author’s judgment is that complexity grows inevitably over the whole lifetime of any program, and that the more people take part and the bigger the program, the harder that complexity is to manage.

My reading

Hidden here is a positive feedback loop, which is the key to the whole book:

Text
complexity ↑ → what fits in mind ↓ → slow risky edits → bugs ↑
    ▲                                                        │
    └─ fixing bugs adds new dependencies and special cases ←─┘

Three key observations:

  1. The unit of complexity is “dependency”; its medium is “the mind.” The author speaks of “subtle dependencies” between components and of having to “keep all the relevant factors in your head” when changing a system. Chapter 2 will name dependency and obscurity as the two causes of complexity, and will say that complexity is more obvious to readers than to writers. One step further (my own understanding): complexity is relative to the observer—the same code is “obvious” to a senior maintainer and “incomprehensible” to a newcomer. So “understandable” is not an intrinsic property of code but a relationship between code and reader—which is also the root of the book’s claim that software should be designed for ease of reading, not ease of writing.
  2. “Inevitably” is not fatalism but an acknowledgment of entropy. The author does not say complexity can be eliminated, only that it grows; what we can control is the rate of growth. The goal of all the later principles is to slow that rate, not to pursue a zero-complexity utopia. This attitude runs through the book: in the preface the author suggests readers take the book’s advice “with a grain of salt,” because the overall goal—reducing complexity—matters more than any specific principle.
  3. Size and headcount are amplifiers. The larger the program, the more possible dependencies between components (roughly quadratic); the more people, the harder it is to propagate “the context every modifier must understand,” because knowledge becomes distributed across different people’s heads. The medium of complexity then expands from “one person’s mind” to “the team’s mind,” which also explains why the book places so much weight on consistency (Chapter 17) and comments (Chapters 12, 13, 15)—they are tools for “carrying” one person’s understanding into another’s head.

Additional examples

  • A typical subtle dependency: a global switch DEBUG_MODE. It has only a dozen references in the code and looks harmless; but in fact it quietly changes the log level, disables the cache, and skips a certain validation. When someone reports “occasional data errors in production,” you have to hold all dozen references in your head to reason about the behavior. No single line of code is “complex,” but together they form an invisible web.
  • The team amplification effect: in a five-person team, the convention “this field is never null” can be maintained by word of mouth; at fifty people, word of mouth inevitably breaks down, so someone adds a null check, someone else relies on “always non-null” elsewhere, and the result is a mess of “sometimes checked, sometimes not”—that is the increment of complexity that comes from lost consistency.

Point 3: Tools help, but only up to a point

From the book

Good development tools make complexity easier to cope with, and many such tools have appeared over the past few decades, but tools on their own can only take us so far. If writing software is to get easier, and more powerful systems are to be built at lower cost, we have to find ways to make the software itself simpler. However hard we try, complexity will still grow over time; what a simpler design gives us is the chance to build bigger and more capable systems before complexity spins out of control.

My reading

This paragraph is a gentle rejection of the popular belief that better tools will solve everything. Tools (IDEs, debuggers, version control, static analysis, test coverage) essentially help you cope with complexity, not reduce complexity. They lower the cost of “accessing complexity” without changing the fact that “the complexity itself exists.” A 100,000-line spaghetti codebase, equipped with the world’s best IDE, is still spaghetti.

The author’s conclusion is pragmatic: simpler design cannot stop complexity from growing, but it lets you get further before being crushed. This is a strategy of “extending the timeline,” not a “cure.”

Extension: what tools can and cannot do

Tool categoryCan doCannot do
IDE / navigation / renameLower the cost of finding codeCannot tell you why two pieces of code are coupled
DebuggerHelp you observe runtime stateCannot put the state into your long-term memory for you
Static analysis / lintMechanically detect patterned problems (unused variables, overly long functions)Hard to detect semantic-level red flags (shallow modules, information leakage, vague names)
Version controlMake changes traceableCannot prevent a bad commit
AI code assistantsDrastically lower the cost of writing codeThe faster you write, the more “code that needs to be understood” piles up (see “Re-examining in the age of AI-assisted programming” below)

This table shows that tools optimize almost entirely the cost of “writing” and “finding,” while complexity consumes the cost of “understanding”—the two are not on the same dimension. This is the fundamental reason the book still matters in an age of abundant tools.

Point 4: Two ways to fight complexity

From the book

There are two ways to deal with complexity, and the whole book will cover both. The first is to eliminate complexity: make the code simpler and more obvious, for example by removing special cases and using identifiers consistently. The second is to encapsulate complexity: let programmers work on a system without having to face all of its complexity at once. This is modular design—dividing the system into modules (such as classes in object-oriented languages) that are relatively independent, so that a programmer working on one module does not need to understand the details of the others.

My reading

These two paths form the warp and weft of the whole book; almost every later principle falls into one of the two categories. The comparison table below is my own organization; the book does not classify them this way:

Eliminate complexityEncapsulate complexity
Core actionMake the code itself simpler and more obviousHide complexity behind module boundaries
Mainly attacksAccidental complexity—special cases, duplication, and vague names that should not existEssential complexity—difficulties inherent in the problem that cannot be eliminated
Benefit felt byAnyone reading this codeUsers of this module (the implementer still faces it)
Typical techniquesEliminating special cases, unifying terminology, consistency, “define errors out of existence”Deep modules, information hiding, general-purpose interfaces, pulling complexity downwards
Corresponding chaptersChapters 6, 10, 14, 17, 18Chapters 4, 5, 8, 9
Failure modeOver-simplification → losing necessary informationLeaky encapsulation → both sides must understand everything, worse than no encapsulation

The relationship: complementary, not substitutes. A good design is usually eliminate first, then encapsulate: first cut away the accidental complexity that can be eliminated, then put the remaining essential complexity into a suitable “black box.” If done in reverse—encapsulate first, leaving a pile of eliminable special cases inside the box—the box’s interface will be bloated by those special cases and become a “shallow module” (the core concept of Chapter 4).

Additional examples (code below under “Extensions and additional examples”)

  • Eliminate: the special case of returning 0 for an empty shopping cart can be dissolved by the idea that “summing an empty collection is naturally 0.”
  • Encapsulate: a text editor’s buffer—the interface has only insert, delete, length, and character access, while the internals can be a gap buffer, piece table, or rope.

Critical analysis: encapsulation is not free

The cost of encapsulation is one more layer of indirection. Callers don’t need to understand the internals, but they do need to understand the semantics of the interface; if the interface is badly designed (many parameters, vague behavior, many preconditions), then “encapsulation” has merely moved complexity from the implementation to the interface, and callers still have to fill their heads. This is why the author repeatedly stresses that modules should be deep (small interface, large implementation) rather than numerous. In other words, the value of encapsulation equals “hidden complexity” minus “complexity introduced by the interface”—only worth doing when the difference is positive.

Point 5: Software’s malleability and the continuity of design—why waterfall fails

From the book

Software is extremely malleable, and so its design is a continuous process running through the system’s whole life; this sets it apart from the design of buildings, ships, bridges, and other physical systems. Early software development, like the other engineering disciplines, put its design at the start of a project; pushed to the extreme, this approach becomes the waterfall model, in which the project is split into stages such as requirements, design, coding, testing, and maintenance, each stage is finished before the next one begins, and the whole system is designed in one go during the design stage.

The author argues that the waterfall model rarely works for software. Software systems are inherently more complex than physical systems, and the design of a large system cannot be fully thought through before implementation begins, so the initial design inevitably has many problems—problems that only surface after implementation is underway. At that point the waterfall model makes it hard to change the design substantially (the designers may have long since moved to other projects), so developers have to patch around the problems without touching the overall design, and the result is an explosion of complexity.

That is why most projects these days follow an incremental approach, agile development being one example: a small slice of functionality is designed, implemented, and evaluated, problems that come up are fixed, and then the next batch of features is added. Spreading design out in this way means flaws in the first design can be put right while the system is still small, and features added later can build on what was learned from the earlier ones. The incremental approach fits software because software’s malleability allows large design changes even when implementation is half done; physical systems make this hard—you can’t very well change how many towers a bridge has while it is being built.

My reading

The logic of this passage is very tight; it can be reconstructed as a “syllogism plus a contrast”:

  1. Major premise: a complex system cannot be fully visualized before implementation.
  2. Minor premise: software systems are “inherently more complex” than physical systems. The reason the book gives immediately after is that the design of a large system cannot have all its implications seen clearly before implementation begins. (My understanding: software has far more possible states and behaviors than systems constrained by physical laws, but the book does not elaborate this way.)
  3. Conclusion: any “do it all at once” design will leave many problems, and those problems only surface after implementation is underway.
  4. Contrast: physical systems cannot be substantially changed midway (you can’t just add bridge towers), so design must be front-loaded; software can be changed midway, so we should use that ability and spread design throughout the process.

There is an easily overlooked insight here: the mechanism by which the waterfall model fails is exactly an amplified version of the vicious cycle in Point 2. Design frozen → problems surface → design can’t be changed → only patching is possible → patches depend on each other → “an explosion of complexity.” The author says explosion, not increase: patches made to work around design problems are worse than getting the design wrong in the first place, because patches scatter decisions that should have been made in one place across every corner of the system—this is the information leakage Chapter 5 describes.

Historical supplement

Royce’s 1970 paper, often treated as the “origin of the waterfall model,” never actually uses the word “waterfall” (the term is generally believed to have first appeared in Bell & Thayer 1976). Right after drawing the linear flow diagram, he writes:

“I believe in this concept, but the implementation described above is risky and invites failure.”

and gives five remedies, one of which is “do it twice”—the delivered version should be the second version. Industry, however, simplified his diagram into a linear process. Ousterhout’s criticism of waterfall is consistent with Royce’s original intent, aimed at that simplified version; and Royce’s “do it twice” echoes in spirit the book’s Chapter 11 “Design it twice.”

Extension: the cost-of-change curve—the economics behind waterfall and incremental development

A common argument for the waterfall model is that “the later a defect is fixed, the more expensive it is”: in Software Engineering Economics (1981), Boehm, based on data from large waterfall projects of the 1970s, produced a curve of change cost rising sharply with phase, often cited as 1:100 (Boehm’s own estimate for small projects was about 1:5–1:10, and the widely circulated “IBM study” claim has been traced to no source; see The Register’s account). Kent Beck, in XP Explained, argues that under specific engineering practices this exponential curve can be flattened; Scott Ambler argues that “the flat curve is just the left half of the traditional exponential curve.” More recent reflections (such as Mike Cohn’s The Cost of Change Curve is Outdated) hold that the curve is “far flatter than people assume, but it has not disappeared.”

The connection to this chapter: incremental development is feasible precisely because modern engineering practices (version control, automated testing, continuous integration) have flattened the first half of the cost-of-change curve; and Ousterhout’s emphasis on “fixing problems while the system is still small” corresponds to the part of the curve that is still low—the further along you go (data, APIs, deployment, organization), the steeper the curve gets.

Critical analysis: software’s “malleability” is not unlimited either

“Malleability” is a somewhat idealized premise in this chapter. In reality, once a software system is in operation, it develops de facto rigidity:

  • Data rigidity: once a database schema has accumulated user data, changing its structure becomes much more expensive (migration, compatibility, rollback).
  • Interface rigidity: once a public API has external callers, changes are no longer an “internal design matter” but an “ecosystem matter.”
  • Deployment rigidity: in distributed systems, old and new versions must coexist online, which constrains many “refactorings.”
  • Organizational rigidity: Conway’s law—system structure tends to mirror organizational structure, and refactoring across team boundaries requires coordination at the organizational level.

So a more accurate statement is: software is highly malleable when unreleased, with no data and no external dependencies, and becomes more like a physical system the further along it gets. The real value of incremental development is not just that “you can change things later,” but that you expose and fix design problems early, while the system is still small and still malleable. The book says to fix problems while the system is small because fixing initial design problems early lets later features benefit from earlier experience; “malleability decays over time” is my added reason, and it makes “early” even more important.

Point 6: Software design is never done

From the book

Incremental development means that software design is never done.

Design goes on throughout a system’s life, and developers should have design questions on their minds all the time. Incremental development also implies continuous redesign: whether for a whole system or a single component, the first design is almost never the best, and experience will inevitably turn up better ways of doing things. Developers should therefore keep an eye out at all times for chances to make the design of their system better, and should plan to spend some of their time improving it. The author then takes the argument a step further: if developers should never stop thinking about design, and the most important task in software design is reducing complexity, then developers should never stop thinking about complexity.

My reading

This is the chapter’s “call to action,” with three conclusions that directly affect an engineer’s daily work:

  1. “The first design is almost never the best” is an empirical regularity, not a failure. The author says almost never and inevitably to reassure developers: don’t expect to get a design right the first time, and don’t conclude the team is incompetent because the first version is imperfect; but at the same time, don’t refuse to change something just because it has already been written.
  2. Design improvement should have a “budget.” The proportion in “plan to spend some of their time” is made concrete in Chapter 3 as roughly 10–20% (see the Chapter 3 notes).
  3. “Complexity” should become the default measure for design decisions. The argument in this passage is a syllogism: developers should keep thinking about design → the most important element of design is reducing complexity → so developers should keep thinking about complexity. This gives the whole book one shared yardstick for evaluation: when you compare two alternatives, you ask not “which is more elegant” or “which fits some pattern better,” but “which leaves the system less complex.”

Additional example

  • “Rethinking design” within one iteration: in week one, to ship quickly, OrderService calls MySqlOrderRepo directly; in week two, the requirement “read from cache” appears, and you find you must change OrderService. There are two choices: (a) add if (cacheEnabled) inside OrderService—this is “patching around the problem,” the beginning of an explosion of complexity; (b) extract an OrderRepo interface implemented by both MySqlOrderRepo and CachedOrderRepo—this is “fixing the design while the system is still small.” The two cost about the same right now, but six months later the difference is an order of magnitude.

Point 7: The book’s two goals and “no simple recipe”

From the book

The book sets itself two goals. The first is to explain what software complexity really is—what “complexity” means, why it matters, and how to spot needless complexity in a program. The second, and the harder of the two, is to offer techniques for keeping complexity as low as possible during development. Unfortunately, there is no simple recipe that guarantees good design; what the author can give instead is a set of high-level concepts of an almost philosophical kind, for instance “classes should be deep” and “define errors out of existence.” Such concepts do not necessarily point straight to the best design, but they can be used to compare alternatives and to guide your search through the design space.

My reading

This is the author’s self-positioning of the book’s method, and it deserves special attention because it determines how you should read the book:

RecipePrinciple / heuristic
Form“If the situation is X, do Y”“Prefer deeper classes”
ApplicabilityEnumerable, mechanically checkableRequires weighing against context
OutputOne definite solutionA yardstick for comparing solutions
Failure modeGives the wrong answer when the situation deviates slightlyOver-application leads to the opposite extreme
The book’s attitudeExplicitly says there is no simple recipe that guarantees good designAdmits to being an opinion piece, invites readers to verify

The value of a “principle” is not in telling you the one right answer, but in making design discussions comparable. When two people disagree on an approach, you can ask: “Which approach has a smaller interface and hides more?” (deep modules) “Which approach makes callers less aware of rarely used features?” (overexposure) “Which approach uses terminology more consistently?” These questions turn a “dispute of taste” into a discussion that can be reasoned about.

Difference from “design patterns”

Design patterns (GoF) are “ready-made solutions for specific situations,” closer to recipes; Ousterhout’s principles are “standards for judging whether a solution is good,” closer to values. Chapter 19 discusses design patterns directly, pointing out that the biggest risk is overuse—forcing a problem into some pattern when a custom approach would have been cleaner. The relationship: patterns are nouns, principles are adjectives—you use principles to judge whether a pattern is being used correctly.

Difference from Clean Code

Both are “soft” methods, but with different emphases: Clean Code (Uncle Bob) stresses function-level hygiene (short functions, few parameters, no side effects), while Ousterhout stresses module-level depth and information hiding, and explicitly opposes the tendencies toward “the shorter the function the better” and “the smaller the class the better”: section 9.8 of the book, A different opinion: Clean Code, and section 12.6 confront Clean Code head-on over function length and comments respectively, and the argument against “the smaller the class the better” is in section 4.6, Classitis.

Section 1.1 of the book: How to use this book

Short as it is, this section is the most “actionable” part of the book, and can be organized into five pieces of advice.

Advice a: The book alone is not enough; use it with code reviews

From the book: the book’s principles are fairly abstract and hard to appreciate without looking at real code; the examples that fit in a book must be small enough to include yet large enough to reflect the problems of real systems, and it is hard to satisfy both, so reading the book alone may not teach you how to apply these principles. The author suggests using it in conjunction with code reviews: when reading other people’s code, think about whether it matches the book’s concepts and how that relates to the code’s complexity. He notes in particular that it is easier to see design problems in other people’s code than in your own.

My reading: code review is the book’s “practice ground,” and it has a psychological advantage: people have an “author’s bias” toward their own code—you know why it was written that way, so it seems obvious to you; when reading someone else’s code, you lack that background and can more accurately sense “how long a newcomer would be stuck here.”

Advice b: Learn to recognize red flags

From the book: of all the ways to get better at design, one of the best is learning to recognize red flags; a red flag is a signal that a piece of code may well be more complex than necessary. Whenever the book discusses a major design problem, it points out the red flag that goes with it, and the most important of these are gathered at the end of the book. When a red flag turns up while you are writing code, stop and try to find an alternative design that makes it disappear.

My reading: red flags are symptoms, not causes. Their role is to trigger a pause: seeing a red flag does not mean there is definitely a problem, but it is worth stopping to think.

Advice c: Don’t give up easily on trying multiple approaches

From the book: when you first start doing this, you may have to try several approaches before finding the one that eliminates the red flag. The author’s words are “Don’t give up easily”: the more approaches you try before solving a problem, the more you learn. Over time, the red flags in your code will become fewer and fewer, and your designs cleaner and cleaner.

My reading: this directly echoes Chapter 11’s “Design it twice.” The author’s view of learning: design ability comes from the experience of repeatedly comparing alternatives, not from memorizing rules. The more alternatives you try, the sharper your intuition for the “design space.”

Advice d: Moderation and balance—“Taking it too far”

From the book:

Every rule has its exceptions, and every principle has its limits.

Any design idea pushed to the extreme probably leads somewhere bad; beautiful design is a balance among competing ideas and approaches. Several chapters of the book have Taking it too far sections on how to recognize when a good thing has been overdone.

My reading: principles are not always consistent with one another; good design balances them rather than pushing any one to the extreme. The book itself gives examples: information hiding is one of the book’s most central techniques, but section 5.9 reminds us that information genuinely needed outside a module must not be hidden—for example, configuration parameters that different callers need with different values. Good design finds the balance point in the current situation.

Advice e: Language-independent

From the book: nearly all of the book’s examples are written in Java or C++, and the discussion mostly takes the class in an object-oriented language as its unit, yet the ideas carry over just as well to other settings: almost everything said about methods also holds for functions in languages such as C that lack object-oriented features, and the design ideas also hold for modules other than classes, for example subsystems and network services.

My reading: “module” is a logical concept, not the same as “class.”

A few places that are easy to confuse

“Complexity” in this chapter vs. Chapter 2

Chapter 1 (this chapter)Chapter 2
How definedDescriptive, cognitive perspectiveFormal definition
Core statement“Hard to keep all the relevant factors in your head”“Anything about how the system is structured that makes the software hard to understand and modify”
CausesImplicitly mentions “subtle dependencies”Explicitly split into dependency and obscurity
SymptomsDevelopment slows, bugs increaseChange amplification, cognitive load, unknown unknowns
PurposeEstablishes the stance that “complexity is the enemy”Provides actionable tools for recognition

This chapter is the “manifesto”; Chapter 2 is the “diagnostic manual.” Together they form the complete theory of complexity.

“Incremental development” does not mean “no design”

A beginner can easily take a dangerous conclusion away from this chapter: “Since design is never finished, just start writing and worry about it later.” That is a misreading of Ousterhout. Chapter 3 makes a point of distinguishing tactical programming (caring only that the code runs right now) from strategic programming (treating design as an investment), and it gives the name “tactical tornado” to the developer who pushes tactical programming as far as it can go, turning out code very quickly while leaving a mess behind. When this chapter says design is never done, it means the duration of design, not its intensity; quite the reverse—precisely because design goes on continuously, every small change is a design decision and is worth a few extra minutes of thought.

Principles are not rules: the book’s “soft” methodology

In the preface Ousterhout says the book is an opinion piece; in Chapter 1 he says “there is no simple recipe that guarantees good design”; in section 1.1 he says “every principle has its limits.” These three self-descriptions together point to a cautious pragmatism: principles are tendencies distilled from extensive practice. They hold in most cases, but they are not logical laws. What the reader is invited to do is not “believe” but “verify”—try it, see whether it actually reduces complexity in your system; if not, don’t use it, and tell the author.

This chapter’s place in the book

Every concept introduced in Chapter 1 is developed in a later chapter:

Concept in this chapterWhere it is developedKeywords
Complexity is the enemy; its definition and symptomsChapter 2Dependency, obscurity, change amplification, cognitive load, unknown unknowns, complexity is incremental
Design as continuous investmentChapter 3Tactical vs. strategic programming, 10–20% investment, startups, technical debt
Encapsulating complexity → modular designChapter 4Deep modules, shallow modules, abstraction, Classitis
Modules “relatively independent” → information hidingChapter 5Information leakage, temporal decomposition, HTTP server example
Eliminating complexity (special cases, consistency)Chapters 6, 10, 17Generalization, define errors out of existence, consistency
Incremental development, continuous redesignChapter 16, section 19.2 of the bookStaying strategic when modifying existing code; the unit of increment should be abstractions, not features
Trying multiple approaches (section 1.1)Chapter 11Design it twice
Recognizing red flagsEach chapter + the summary table at the end of the bookShallow Module, Information Leakage, Temporal Decomposition, Overexposure, Pass-Through Method…
Moderation and balanceThe Taking it too far sections in various chaptersOveruse of any principle

Extensions and additional examples

Eliminating complexity (1): eliminating special cases

Scenario: computing the total price of a shopping cart. Is an empty cart a “case” that needs special treatment?

Java
// Before: an empty cart is an explicit special case
double total(Cart cart) {
    if (cart.isEmpty()) {
        return 0;                      // special case
    }
    double sum = 0;
    for (Item item : cart.items()) {
        sum += item.price();
    }
    return sum;
}
Java
// After: summing an empty collection is naturally 0; the special case no longer exists
double total(Cart cart) {
    return cart.items().stream()
                      .mapToDouble(Item::price)
                      .sum();
}

A special case looks “careful,” but it actually adds one more branch to understand, and that branch is duplicated with the main logic (both define “what the total is”). If the pricing rule changes later (say discounts are added), you must remember to change both places—a tiny instance of “change amplification.”

A more general pattern: when you see if (x == null) return default; in code, ask—can “empty” be represented as a legitimate object (the null object pattern), or can the underlying operation be made to work naturally on “empty”?

Eliminating complexity (2): using identifiers consistently

Scenario: in the same module, three files use block, chunk, and segment respectively for “a fixed-size sequence of bytes.”

Java
// file A                          // file B
class BlockReader {                 class ChunkCache {
    readBlock(int idx)                 getChunk(int idx)
    blockCount()                      chunkCount()
}                                    }
                                   // file C
                                   int segmentSize;

To the author they are the same thing; to the reader, “are block and chunk the same concept? Is segment a larger unit?”—these three questions hang in the reader’s head the whole time. The reader is forced to maintain a terminology mapping table in their head, which is pure accidental complexity. The fix is simple: pick one word and use only it throughout the codebase (section 14.4 of the book, Use names consistently).

Encapsulating complexity (1): what a deep module looks like

Scenario: a text editor needs a text buffer with efficient insertion and deletion. The internal implementation can be a gap buffer, piece table, or rope—each quite complex.

Java
/**
 * An editable text buffer. All implementation details (gap position, piece table structure) are invisible from outside.
 */
public final class TextBuffer {
    /** Insert s at offset. offset must be in [0, length()]. */
    public void insert(int offset, String s) { ... }

    /** Delete count characters starting at offset. */
    public void delete(int offset, int count) { ... }

    public int length() { ... }
    public char charAt(int offset) { ... }
}

The caller only needs to understand 4 methods and has no need to know whether the internals are a gap buffer or a rope. Small interface, deep implementation—this is exactly what Chapter 4 calls a “deep module.” Contrast a “shallow” design: exposing the internal array and gap boundaries as public fields, plus 20 fine-grained operations; callers can “use” it, but must understand all the implementation details to use it correctly.

Encapsulating complexity (2): failed encapsulation—information leakage

Java
// Two modules each "independently" know the format of HTTP headers
class HttpRequest {
    String contentType() {
        // knows that "a/b; charset=utf-8" is split on ';'
        String raw = header("Content-Type");
        return raw.split(";")[0].trim();
    }
}

class HttpResponse {
    void setContentType(String type, String charset) {
        // also knows the same format
        setHeader("Content-Type", type + "; charset=" + charset);
    }
}

On the surface these are two independent classes, yet the design decision “how an HTTP header is formatted” is reflected in both modules. If the format ever changes (for instance, to support several parameters), both places have to be changed, and you have to remember both places at the same time. Chapter 5 calls this information leakage and counts it as one of software design’s most important red flags—harder to spot than “duplicate code,” because what leaks is often not code but knowledge.

The full story of a waterfall failure

A team designs a “notification system” using the waterfall approach. After three months of design reviews, they produce a Notification abstraction with two implementations, EmailSender and SmsSender, distinguished by an enum ChannelType { EMAIL, SMS }. The design is frozen and implementation begins.

Two months into implementation, product asks for “in-app push”; four months in, “localize messages by user language.” At this point:

  • The enum ChannelType is switched on in 14 places; adding a channel means changing 14 places—change amplification.
  • Localization needs “template variables,” so someone adds Map<String,String> variables to Notification; another team, unaware of this, adds a templateId to EmailSender—two sources representing the same thing.
  • The design document is long outdated; new members can only guess by reading code—unknown unknowns.

This is the typical path of “patching around problems leading to an explosion of complexity.” The incremental approach: first do email notification only, ship it, observe what callers actually need; but from the start, design “sending” as a somewhat general-purpose interface (say Channel.send(Message)), with email as its first implementation and SMS and push added later as more implementations (the Chapter 3 notes have the same example). Section 6.1 of the book says the sweet spot for a new module is “somewhat general-purpose”: the functionality should reflect only current needs, but the interface should not be bound by current needs; section 19.2 also warns that “build the smallest specialized implementation first and refactor into a general one later” encourages tactical programming. This way, each step of the design is built on experience already gained, not on guesses from three months earlier.

Red flag recognition exercise

The code below has several places that make complexity higher. Try to find them yourself before reading the answers.

Java
public class ReportService {
    private Database db;
    private Config config;

    public byte[] generate(int reportId, String format, boolean compress,
                            boolean includeHeader, String locale, User user) {
        if (format.equals("pdf")) {
            return generatePdf(reportId, compress, includeHeader, locale, user);
        } else if (format.equals("csv")) {
            return generateCsv(reportId, compress, includeHeader, locale, user);
        } else {
            throw new UnsupportedFormatException(format);
        }
    }

    public Database getDatabase() { return db; }       // for external direct queries
    public Config getConfig()   { return config; }    // for external reading of flags
    public byte[] generatePdf(int id, boolean c, boolean h, String l, User u) { ... }
    public byte[] generateCsv(int id, boolean c, boolean h, String l, User u) { ... }
}

Reference answers

  1. Overexposure: generate has 6 parameters; a caller who just wants to “generate a PDF” must also understand compression, header, language, and user options—to use a common feature, they are forced to learn about uncommon ones.
  2. Violation of information hiding: getDatabase() and getConfig() hand out the internally used database and configuration; external code will start depending on them directly, and ReportService can no longer be called “relatively independent.”
  3. The same set of options written three times, plus two extra entry points: generatePdf and generateCsv are also public, with signatures almost identical to generate. Adding an option means changing three methods (change amplification), and callers have two ways to do the same thing. Note that generate itself is not a pass-through method: it selects which method handles the request based on format—it is what section 7.2 of the book calls a dispatcher, and the book explicitly says such a method provides useful functionality.

One direction for improvement: collect the options into a ReportOptions value object, make “format” a strategy object Formatter (PdfFormatter, CsvFormatter), expose only generate(int reportId, Formatter format, ReportOptions opts), and remove the two getters and the two public generateXxx methods. If callers pass a Formatter object directly, the “unsupported format” error ceases to exist at compile time—one use of “define errors out of existence”; if you still look up a format string in a registry, you still have to report an error when it is not found—the error has merely moved.

“Moderation”: what pushing a principle to the extreme looks like

This chapter repeatedly stresses not going to extremes. Here are two concrete examples of what “a good thing overdone” looks like:

  • “Define errors out of existence” overdone: to spare callers from handling exceptions, “file not found” is also returned as empty content. Callers indeed no longer need to handle exceptions, but real data loss is masked—section 10.9 of the book, Taking it too far, discusses this overuse specifically, with the criterion: only when the exception information is of no use outside the module does it make sense to define it away or mask it inside the module; information needed outside the module must be exposed.
  • “Deep modules” overdone: to keep the “interface small,” everything is stuffed into one giant Manager/Context class. The interface indeed has only a few methods, but the semantics of each method are so vague that you must read the implementation to use them. This is no longer “deep” but “opaque”—depth presupposes clear interface semantics.

Extended thought: re-examining in the age of AI-assisted programming

The chapter’s argument has become even more worth attending to after the spread of AI code assistants (the following is my own extension, not the book’s content):

  • Ousterhout’s core judgment is that the bottleneck is “understanding,” not “writing.” AI assistants mainly lower the cost of writing and hardly lower the cost of understanding—the more code generated, and the faster, the more code there is that needs to be understood by people, so the cognitive bottleneck arrives even sooner.
  • Section 1.1 of the book says “it is easier to see design problems in other people’s code,” and AI-generated code is, to the developer, exactly “other people’s code”—free of author’s bias, and perfectly suited to review with the book’s red flag checklist.
  • “Design it twice” (Chapter 11) becomes cheaper in the AI age: have the assistant produce two or three design alternatives at once, then compare them using the book’s principles (which has the smaller interface, which leaks less, which is more consistent)—exactly the role the author assigns to these principles: they may not directly point to the best design, but they can be used to compare alternatives.
  • Conversely, AI can also amplify the “explosion of complexity”: if a team uses AI to produce code at tactical-programming speed without investing in design, the “technical debt” of Chapter 3 accumulates even faster.

Extended thought: complexity and collaboration scale

This chapter says “the more people, the harder complexity is to manage.” That can be expanded into three corollaries:

  1. The knowledge distribution problem: in a small team, “the whole system” roughly exists in everyone’s head; in a large team, no single person has the whole picture, and the system must rely on module boundaries + documentation + consistency to make parts of it locally understandable—this is exactly what the second half of the book (comments, consistency, obvious code) serves.
  2. Brooks’s law and communication overhead: among n people there are n(n−1)/2 communication paths; the more people, the higher the alignment cost. The organizational counterpart of modular design is minimizing the number of communication paths needed—letting most people only need to understand their own module’s interface.
  3. Conway’s law: system structure mirrors organizational structure. Conversely, deliberately designing module boundaries (this chapter’s “encapsulating complexity”) can also be used to shape collaboration structure—the idea behind the “Inverse Conway Maneuver.”

Connections to classic ideas

This chapter’s position does not come from nowhere; it is the confluence of several classic lines of thought. The table below compares them, to place the book in a larger context (sources at the end, under “Sources”).

Classic ideaCore claimRelation to this chapter
Brooks, No Silver Bullet (1986/1987)Distinguishes essential complexity (essence: creating “complex conceptual structures of abstract software entities”) from accidental complexity (accident: expressing them in a language and mapping them to a machine); “unless accidental work accounts for more than 9/10 of all effort, reducing it to zero will not give an order of magnitude improvement”This chapter’s “complexity is inevitable” agrees with Brooks; Ousterhout’s two paths roughly correspond to eliminating accidental complexity / encapsulating essential complexity
Dijkstra, The Humble Programmer (EWD340, 1972 Turing Award lecture)“The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility…”Directly corresponds to this chapter’s “understanding bottleneck”: the central problem of software design is the capacity of the human brain. The other often-quoted line, “Simplicity is prerequisite for reliability,” is from EWD498 (1975)
Hoare’s 1980 Turing Award lecture, The Emperor’s Old Clothes (CACM 1981)“there are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”Corresponds to this chapter’s “eliminate” path of “making code simpler and more obvious”; note the original says “constructing a software design,” not the commonly circulated “writing a program”
Parnas, On the Criteria To Be Used in Decomposing Systems into Modules (CACM 1972; first released as a Carnegie Mellon technical report in 1971)The goal of modularization is information hiding: modules should be divided around “design decisions likely to change” (secrets), not around flowchart steps; the goal is to let modules be developed independently, modified separately, and understood one at a timeThe book’s Chapter 5 “information hiding” and the “temporal decomposition” red flag come directly from Parnas; in the preface the author says that in the forty-five years since this 1971 paper, the state of software design has not advanced much
Royce 1970Often treated as the “origin of the waterfall model,” but the original actually criticizes the risk of “doing it all at once” and proposes “do it twice”This chapter’s criticism of waterfall is consistent with Royce’s original intent; both hold that a large system cannot be fully visualized before implementation (see Point 5 above)
Agile Manifesto (2001)“Welcome changing requirements, even late in development.”; “Continuous attention to technical excellence and good design enhances agility.”; “Simplicity—the art of maximizing the amount of work not done—is essential.”This chapter’s “incremental development + continuous design” is consistent with agile; but section 19.2 of the book also warns that agile development easily leads to tactical programming: it focuses developers on features rather than abstractions, and encourages postponing design decisions to deliver sooner
Spolsky 2000, Things You Should Never Do“It’s harder to read code than to write it.”—called “a cardinal, fundamental law of programming”Corresponds to the book’s Chapter 18 “code should be obvious” and the principle of designing for reading; also explains why AI-accelerated writing does not solve the fundamental problem
Conway 1967 / Brooks, The Mythical Man-MonthSystem structure mirrors organizational structure; communication paths grow quadratically with headcountCorresponds to this chapter’s “the more people, the harder complexity is to manage”

One key difference: Brooks is fairly pessimistic about “essential complexity” (no silver bullet), while Ousterhout, though acknowledging that complexity is inevitable, is optimistic about significantly slowing its growth through better design practices, and tries to make those practices teachable: in the preface he disagrees with the view that “design ability is innate and cannot be taught,” citing Talent is Overrated, which argues that outstanding performance in many fields comes more from high-quality practice than from talent. This is the book’s fundamental stance as a textbook rather than a treatise.

Disputes and differing views

Ousterhout himself calls the book an opinion piece, and the second edition adds A different opinion sections in several chapters, presenting opposing views head-on. Around this chapter’s position, the main disputes are:

DisputeOusterhout’s positionOpposing viewCommentary
Should classes be small or deepClasses should be “deep”—small interface, much implementation; opposes splitting classes very small (“Classitis”)Clean Code tends toward “classes should be small,” one class doing one thingThe two are not entirely contradictory: Ousterhout opposes shallowness, not smallness; but “small and shallow” classes do often appear together in practice
The value of commentsComments are very important; “good code is self-documenting” is an excuseClean Code sees comments as “a sign of failure,” to be expressed in code as much as possibleSection 12.6 of the book, A different opinion: comments are failures, responds to this opposition; Ousterhout’s rebuttal: some information (the why, cross-module conventions) cannot be expressed in code
The role of TDDSupports unit testing, but does not endorse test-driven developmentThe TDD community believes TDD naturally produces good designSection 19.4 of the book discusses this head-on: the author thinks TDD focuses attention on making specific features work rather than finding the best design, and is tactical programming pure and simple. From September 2024 to February 2025, Ousterhout and Robert Martin (Uncle Bob) held a public written dialogue on these disagreements (aposd-vs-clean-code), with TDD among the topics; the dialogue was later included as an appendix in the second edition of Clean Code (2025)
Getters/settersOpposes exposing getters/setters thoughtlessly (exposing instance variables violates information hiding, and getters/setters themselves are shallow methods)Required by the JavaBeans conventionSection 19.6 of the book
Inheritance vs. compositionImplementation inheritance creates dependencies between parent and child classes; consider composition firstMany introductory OOP textbooks treat inheritance as the main way to reuse codeSection 19.1 of the book. Note that GoF Design Patterns itself advocates “Favor object composition over class inheritance,” standing on the same side as this book on this point
Incremental development vs. up-front designIncremental development + continuous design investmentCritics worry that “continuous design” becomes “always tactical” in practiceSection 19.2 of the book takes on this risk directly: incremental development is a good thing, but the unit of increment should be abstractions, not features (principle 15 in the summary at the end of the book); section 19.4 adds that as soon as you find you need an abstraction, you should get its design done in one go instead of putting it together piece by piece. Chapter 3’s “strategic programming” answers from the angle of mindset: working incrementally does not mean skipping design
The book’s empirical basisComes from the author’s own experience writing and reading code (the preface says he has written about 250,000 lines), and observations from CS 190The book has no controlled experiments; whether its advice generalizes is for readers to test themselvesIn the preface the author calls the book an opinion piece, concedes that some of its suggestions could, in the long term, prove to be bad ideas, and invites readers to check it against their own experience. In the Hacker News thread about the book, the sharpest criticism actually went to Clean Code, for chopping code up too finely (discussion)

Overall reception of the book: the book is highly regarded in the technical community. On Hacker News someone wrote, “This short book is (IMHO) one of the best on software design.” (link); of the 236 HN commenters who mentioned it, as counted by hackerbooks, about 70% recommended it (link).

The attitude to have after reading this chapter: treat the book as “a set of tendencies distilled from extensive practice, worth verifying,” not as dogma. This is exactly what section 1.1 means by “moderation and discretion.”

Checklist: applying Chapter 1 to daily work

When writing code / making design decisions

  • Ask yourself: does this change make “the things you must remember at once when changing one place” more or fewer?
  • When you see a special case (an if handling some “special situation”), ask: can this situation be made to not exist at all?
  • Is the same concept referred to by only one word in the codebase?
  • Is this module’s interface clearly simpler than its implementation? (deep vs. shallow)
  • Does any “design decision” appear in two places at once? (information leakage)
  • When two alternatives are deadlocked, compare them using the book’s principles as a yardstick, rather than by who is louder.

When doing code reviews

  • Go through the red flag list at the end of the book one by one (Shallow Module, Information Leakage, Temporal Decomposition, Overexposure, Pass-Through Method, duplication, Vague Name, Hard to Name, Hard to Describe, Nonobvious Code…).
  • When you see a red flag, don’t stop at “pointing out the problem”—propose an alternative design that eliminates it, and try to propose several.
  • Distinguish “I don’t like this style” from “this increases complexity”—insist only on the latter.

On project rhythm

  • Reserve explicit time for design improvement (Chapter 3 suggests about 10–20%), rather than “refactor when there’s time.”
  • Fix design problems while the system is still small—the later, the closer it gets to a “physical system.”
  • Watch for the tendency to “patch around design problems”—it is the precursor to an explosion of complexity.

When using the principles

  • For every principle you apply, ask: “In this situation, have I pushed it too far?”
  • When principles conflict, return to the overall goal: which choice makes the system less complex?

Key terms

EnglishChineseMeaning in this chapter’s context
complexity复杂性Anything that makes software hard to understand and modify; this chapter describes it from the angle of “hard to keep the relevant factors in your head”
dependency依赖Subtle mutual influence between components; a major source of complexity (formally defined in Chapter 2)
eliminate complexity消除复杂性Make the code itself simpler and more obvious
encapsulate complexity封装复杂性Hide complexity behind module boundaries
modular design模块化设计Dividing a system into relatively independent modules so a programmer can understand just one module
malleable / malleability可塑性The property of software that allows major design changes midway through implementation
waterfall model瀑布模型A development approach of requirements→design→coding→testing→maintenance completed phase by phase, with the design frozen
incremental approach / agile development增量方法 / 敏捷开发A development approach of designing, implementing, and evaluating small subsets, iterating forward
continuous redesign持续再设计Design spans the system’s lifetime; the first design is almost never the best
red flag红旗A signal that a piece of code may well be more complex than necessary
Taking it too far做过头The sections in various chapters discussing over-application of a principle
special case特殊情况A branch needed only under specific conditions; a common source of accidental complexity
deep module深模块A module with a small interface and much implementation (Chapter 4)
information hiding / leakage信息隐藏 / 信息泄漏Modules should hide design decisions; the same decision reflected in multiple modules is leakage (Chapter 5)
pass-through method直通方法A method that does little beyond handing its arguments on to a second method whose signature is much like its own (a red flag); a dispatcher, which uses an argument to pick the method it calls, does not count
tactical vs. strategic programming战术编程 vs. 战略编程Only caring that it works right now vs. treating design as a long-term investment (Chapter 3)
design it twice设计两次Trying multiple designs for the same problem and then choosing the best (Chapter 11)
opinion piece观点之作The author’s self-positioning of the book: a set of verifiable tendencies, not dogma

Questions to think about

  1. Explain in your own words: how does the author get from “programming is unconstrained by physical laws” to “the greatest limit on writing software is our ability to understand”? Where is the gap in this reasoning?
  2. Has the “vicious cycle” this chapter describes (complexity → slower → bugs → slower) appeared in projects you have experienced? What was the trigger? Was the response “patching” or “changing the design”?
  3. The author says “eliminating complexity” and “encapsulating complexity” are two paths. Give an example from your codebase, say which category it falls into, whether the other approach would also apply, and why this one was chosen.
  4. In what situations is the waterfall model still reasonable? (Hint: think about “software’s malleability is not unlimited” above, and safety-critical systems.)
  5. How do “software design is never done” and “delivering on time” reconcile? Is Chapter 3’s “10–20% investment” a workable answer?
  6. The author says these principles may not directly point to the best design, but can be used to compare alternatives. Take a recent design decision of yours and re-compare the candidate options using two of the principles.
  7. Take a piece of code you wrote recently and check it against the red flag list at the end of the book; see how many you find. For each, propose at least two alternative designs.
  8. Do you agree that “design ability can be acquired through practice, rather than being innate”? What does that imply for how you learn?

Next

Chapter 1 brings “complexity” on stage as the enemy, but deliberately gives no precise definition. The Chapter 2 notes will supply it: the definition of complexity, its three symptoms, its two causes, and why it accumulates bit by bit.

Sources

The book

Classic works

The cost-of-change curve

Reception and disputes

Footnotes

  1. The second edition was published in July 2021 (v2.0). On the book’s homepage the author lists the main changes from the first edition: a new chapter Decide What Matters (Chapter 21), a rewritten and expanded Chapter 6, and sections in two chapters comparing with Robert Martin’s Clean Code (sections 9.8 and 12.6 in the book). ↩︎