Book Deep-Read · Software Engineering at Google · Chapter 1
Software Engineering at Google · Ch 1 · What Is Software Engineering? · Titus Winters · 2020
The search box, maps and email on your phone run on code that, in some cases, has been alive for more than twenty years and is still edited by thousands of engineers every day. This chapter asks a deceptively simple question: what is the difference between "programming" and "software engineering"? The answer: time and people.
A shopping list you write for yourself can be scrawled and thrown away. A cookbook that hundreds of kitchens will use for twenty years, through new pans, new ingredients and new tastes, is different: can others read it? Can it be revised? If one day grams must become ounces, can you make the change? The shopping list is programming. The twenty-year cookbook is software engineering.
A supermarket never promised that the milk would always sit by the door. Yet after a few years, some regulars walk straight there with their eyes closed. The day the shelves move, they come up empty-handed. Software works the same way: once enough people use something, every little habit it has, even one nobody promised, will be relied on by someone. The author's colleague Hyrum turned this into a "law". That is why the hard part of old code is usually not writing it but changing it.
To decide which standard a piece of code deserves, ask: how long will it live, and how many people will change it? For a one-off script, just be fast; for a system maintained for years, pay extra effort so it can still be changed later. The honest cost: this approach is slower up front, and on a small team or a short project it may be pure overhead.
Programming makes code run today; software engineering keeps it changeable for many years, in many hands.
Want the precise meaning of "programming integrated over time", Hyrum's Law and the true story of hash ordering, how the Beyoncé Rule and the churn rule make upgrades scale, the six kinds of cost, and real numbers from Google's monorepo? → Switch to the deep read
You might think software engineering is just programming done better; this chapter says they differ in dimension: software engineering is "programming integrated over time" — multiplied by the number of people involved, with every trade-off priced explicitly. The same code living five minutes or twenty years belongs to two different disciplines.
The opening chapter of the book and the only one in Part I, "Thesis", written by Titus Winters. It sets the book's master claim — time, scale, trade-offs — and everything after it, culture (Ch2–7), processes (Ch8–15: review, testing, deprecation) and tools (Ch16–25: monorepo, builds, dependencies, large-scale changes, CI/CD), answers questions raised here.
"Software engineering" is used loosely: writing a script is called engineering, and so is maintaining a twenty-year-old search system. If the two were the same thing, then Google's monorepo, mandatory testing and automated migrations would all look like bureaucracy.
The chapter explains why a piece of code's lifespan and number of contributors completely change what good practice is. Get this wrong and either you write a throwaway script like aerospace software, wasting effort, or you write a ten-year system like a script — until the day you must upgrade the compiler or patch a security hole and discover you simply cannot change it. The system still runs, but it has lost the ability to respond to change.
The author names three fundamental differences between programming and software engineering:
The chapter offers a memorable test: it's programming if "clever" is a compliment, but it's software engineering if "clever" is an accusation. In long-lived code, an ingenious trick nobody else can read is a landmine for future maintainers.
Expected code lifespans range from minutes (a one-off script) to decades (systems like Google Search); the author estimates the two ends differ by a factor of at least 100,000. That span decides one thing: how much upgrades (responding to changes underneath) matter. Code that lives a few hours almost never meets a changed dependency; code that lives five years or more almost certainly will.
From this comes the chapter's definition of sustainable: for the expected life span of your software, you are capable of reacting to whatever valuable change comes along, for technical or business reasons. Note "capable", not "must change every time": you may choose not to upgrade, but if you are unable to, you are betting that nothing will change — a bet you almost always lose.
The author stresses that the first big upgrade is usually the most painful. A project that has never swapped its foundations accumulates hidden assumptions: behaviors that "happen" to hold, dependencies nobody recorded. Nobody has done this upgrade, there are no tools, nobody knows what will break, so it costs a fortune; later upgrades benefit from experience and tooling.
The chapter's most famous idea, named after co-author Hyrum Wright:
With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.
Intuition: the contract is a small circle you draw, but users see the whole system — return order, timing, error text, memory use. With enough users, someone deliberately or accidentally depends on something outside the circle. So any change, even one entirely within the contract, can break someone.
The book's example is hash ordering: a hash table's iteration order is never guaranteed, yet some code always assumes it is fixed — say, comparing iteration output directly against a test's expected value. When the underlying hash function is replaced by a faster, safer one, the order changes and that code breaks. The book's conclusion is pragmatic: since "you shouldn't depend on it" doesn't stop people depending on it, make bad habits surface early — for instance, shuffle the order on every run, so anyone relying on it fails in tests immediately.
The chapter then asks: why not just aim for "nothing changes"? Because you can't. Security vulnerabilities (the book cites Heartbleed and Meltdown/Spectre), new hardware, new performance opportunities and business shifts all force change. "Never upgrade" isn't an option; it just postpones the bill and makes it bigger.
The chapter's scaling principle: everything an organization has to do repeatedly should scale linearly or better in human input; otherwise the bigger the organization, the more it is dragged down. The author names two policies that don't scale:
And two policies that do scale:
The book's compiler upgrade story ties these together. Early on, compiler upgrades at Google were extremely painful: long gaps, many hidden dependencies. Upgrades became routine thanks to five things: expertise (people who had done it many times), stability (more frequent, smaller upgrades, so less change each time), conformity (less code that had never been through an upgrade, fewer "only this works" special cases), familiarity (doing it often led to automating it), and policy (such as the Beyoncé Rule). The key insight: the more often you upgrade, the cheaper each upgrade gets — the opposite of the instinct that leaving things alone is safest.
Draw the developer workflow as a timeline from left to right: concept → design → develop → test → commit → integrate → production. The further right a bug is found, the more it costs to fix: in development a compiler message takes seconds to address; in production, found by users, it means investigation, rollback and a postmortem. Shifting left means pushing static analysis, code review and testing as far left as possible — the shared motivation behind the book's later chapters on review (Ch9), testing (Ch11–14) and static analysis (Ch20).
The chapter asks that every decision come with reasons; "because I said so" is a terrible reason to do things. There are at least six kinds of cost: financial (money), resource (such as CPU time), personnel (engineering effort), transaction (what it costs to take action), opportunity (what it costs not to take action) and societal (the impact on society at large).
Two of the book's examples are vivid:
Finally, the chapter admits decisions will be wrong: most decisions rest on a mix of data, assumption and argument. Being data driven is a good start, but the environment shifts, so revisit decisions regularly; only an organization able to say "we were wrong, let's change" has a claim on the long term.
Table 1 · Programming vs software engineering: not better or worse, just different constraints
| Dimension | Programming (short-lived, few people) | Software engineering (long-lived, many people) |
|---|---|---|
| Lifespan | minutes to weeks | years to decades; upgrades are certain |
| "Clever" | a compliment | an accusation: unreadable means liability |
| Dependencies | may rely on incidental behavior | under Hyrum's Law incidental behavior will be relied on; break it on purpose |
| Tests / review | optional | the price of protection (Beyoncé Rule) |
| Cost | fast | slower up front; pure waste on a throwaway script |
Table 2 · Migration policy: who pays the bill
| Policy | Human cost vs scale | Fits | Honest cost |
|---|---|---|---|
| Users migrate themselves | users × cost per user; less likely to finish as you grow | few users, very stable interface | migrations drag on for years, old and new coexist |
| Churn rule: changers migrate | concentrated in a few experts + tools; roughly scalable | a monorepo where all callers are visible and editable | heavy load on infra teams; needs large-scale-change tools and full test coverage |
| Permanent backward compatibility | zero cost to users | public external APIs, unreachable callers | legacy baggage forever; the interface grows uglier |
| Beyoncé Rule as backstop | each team writes tests for itself | organizations with shared CI | with uneven test quality, "you had no test" becomes a way to dodge blame |
The rule of thumb: first estimate expected lifespan and number of users. If lifespan is measured in hours, the left column of Table 1 is entirely right; if it is measured in years and users in thousands, follow the right column and Table 2's churn rule — or the first forced upgrade will reveal a bill larger than a rewrite.
This chapter gives reviews and interviews a universal yardstick: to judge any engineering practice, first ask how it behaves along the axes of time and scale. "Should we write unit tests?", "should we enforce one code style?", "should we upgrade dependencies?" — all depend on how long the code will live and how many people will touch it. Asked about technical debt in an interview, define it through "sustainable = able to respond to change", and use Hyrum's Law to explain why old systems grow ever scarier to change.
EVIDENCE FROM INDUSTRY · PUBLICLY VERIFIABLE
1 billion files, about 2 billion lines of code and 35 million commits, developed trunk-based with virtually no long-lived branches — the soil in which this chapter's "long-lived branches don't scale" and the churn rule can work: infrastructure teams can see and directly edit every caller.Potvin & Levenberg, "Why Google Stores Billions of Lines of Code in a Single Repository," CACM 2016 ↗raw_hash_set.h says each table mixes in a per-table seed to randomize iteration order — "the seed is needed to ensure non-determinism of iteration order" — and another comment notes that "in order to prevent user code from depending on iteration order for small tables, we would need to randomize the iteration order somehow". Hyrum's Law countermeasures, written into the source.abseil-cpp · absl/container/internal/raw_hash_set.h ↗① Software engineering = programming integrated over time, multiplied by people and trade-offs; three dimensions: time and change, scale and growth, trade-offs and costs.
② Code lifespans run from minutes to decades, at least 100,000× apart; lifespan decides how much upgrades matter.
③ Sustainable = able to respond to valuable change over the expected lifespan; the first upgrade hurts most.
④ Hyrum's Law: with enough users, every observable behavior is depended on; counter it by breaking incidental dependencies on purpose (e.g., randomized hash order).
⑤ "Clever" is a compliment in programming and an accusation in software engineering.
⑥ The human cost of repeated work must scale: self-service deprecations and long-lived branches don't; the churn rule and the Beyoncé Rule do.
⑦ Lessons from compiler upgrades: expertise, stability, conformity, familiarity, policy — the more often you upgrade, the cheaper each one gets.
⑧ Shift left: the earlier a defect is found, the cheaper it is; this motivates review, testing and static analysis.
⑨ Count six kinds of cost and never decide "because I said so"; beware Jevons paradox, and revisit decisions regularly.