Book Deep-Read · Software Engineering at Google · Chapter 10
Software Engineering at Google · Ch 10 · Documentation · Tom Manshreck · 2020
Behind every app on your phone and every website you visit, engineers write "instruction manuals" for each other: how this feature is used, what that button actually does, where a new hire should start reading on day one. This chapter is about how Google keeps those manuals accurate, current and easy to find.
Nearly every engineer complains that the docs are bad, and nearly every engineer avoids writing them. It isn't laziness: the benefits of writing docs mostly land on other people and the future, while all the hassle lands on you, today.
Early on, Google kept its docs on an internal wiki that anyone could edit. The result: several versions of the same story and nobody sure which was right; pages abandoned when their author changed teams; readers who spotted a mistake with nobody to tell. Docs and code lived in two different places, so whenever the code changed, the docs quietly turned into lies.
What should your team do? Move the handful of most-used docs next to the code, update them in the same change and have a colleague look at both; boldly delete the ones nobody uses. The honest cost: every change takes a little longer, and without dedicated writers, the quality of the prose depends entirely on the engineers.
Docs are code: same home, same review, an owner, and an expiry date.
Want the seven ways docs are like code, Google's move off the wiki, the two kinds of readers, five doc types, three kinds of review and the "complete / accurate / clear" pick-two? → Switch to the deep read
You think bad docs mean "engineers can't write". This chapter says it is mostly that the process puts docs in the wrong place: away from the code, with no owner, no review and no expiry. Google's answer is to treat documentation like code: same repository, same change, same review, plus a writing discipline of knowing your audience and giving each doc a single purpose.
# and *; the source is readable as is.Third chapter of Part III, "Processes". It follows Ch9 Code Review (doc changes go through the same review flow) and leads into the testing chapters from Ch11 (docs, like tests, are an engineering discipline whose payoff comes later). Real-world counterparts: READMEs, API comments, design docs, internal wikis, and the "docs as code" movement.
The chapter opens with an observation: in surveys of Google engineers, documentation regularly ranks among the biggest pain points, yet few people write it. The author lists why: engineers see writing as a separate skill from programming; doc tools live somewhere other than code tools, so switching is costly; and most fundamentally, the benefits are downstream. The writer pays now; the reader (including the writer, three months later) collects.
Yet docs do pay the writer directly: writing an API description forces you to work out what the interface should look like; it is a roadmap for future maintenance; it makes code look professional and trustworthy; and it heads off a flood of repeated questions. What happens if you don't fix this? Ch1 calls software engineering "programming integrated over time": when code lives for ten years and passes through a hundred hands, undocumented knowledge lives only in a few heads, and leaves when they do. The chapter asks: how do you keep docs trustworthy at that scale and over that time?
The chapter's central claim: documentation is so tightly coupled to code that it should, as much as possible, be treated as code. Concretely, documentation should:
Why this design? Because code already has infrastructure for every one of these: the repository, review, OWNERS, the bug tracker. Hook docs onto rails that already exist, and you don't need to invent a separate process nobody uses. The chapter's TL;DR says the same: documentation changes should leverage the existing developer workflow.
Early on, Google kept most engineering docs on an internal wiki, GooWiki. A wiki is easy to write in, but at scale the problems showed: many pages had no clear owner and went stale unchecked; one topic spawned several contradictory pages; readers who found errors had no channel to report them. The wiki was easy to write and nobody's job to maintain.
The turning point was moving docs into source control: docs written in Markdown inside the code directories, rendered as web pages by an internal system called g3doc. Docs now came with an owner (the directory's OWNERS), review (the same CL) and history, and engineers no longer had to leave their coding environment. The book admits the migration was not smooth and some people resisted changing habits, but it made "update the docs while you change the code" natural for the first time.
The chapter says the most important mistake in writing docs is not knowing your audience. Readers differ by experience level (expert or novice), domain knowledge, and purpose (end user, or developer who will change the code). Two more memorable splits:
The chapter quotes Pascal: "If I had more time, I would have written you a shorter letter." Short and precise is harder to write than long and exhaustive, but far kinder to the reader.
Mirroring Chapter 9's three approvals, an important doc should answer three different questions:
Answer the 5 Ws up front: who it is for, what its purpose is, when it was written and last reviewed, where it should live, and why: what the reader can do after reading it. A doc needs a beginning, middle and end, organized into sections, not a wall of text.
Good documentation is complete, accurate and clear, but rarely all three at full strength in one doc: API comments favor accuracy and completeness; conceptual docs favor clarity. Hence the rule that each document should serve a single purpose: a doc trying to be a tutorial, a reference and a design rationale at once does all three badly.
Docs go stale and must be deprecable. An old doc is worse than none, because it misleads. The book describes embedding a "freshness" date in each doc recording its last review; if it goes untouched past a set window (the book's example is three months), the system reminds the owner to review it. Docs that no longer apply should be clearly marked deprecated, or deleted.
Table 1 · Where docs live: three common approaches
| Approach | Upside | Honest cost | Good for |
|---|---|---|---|
| Wiki / doc platform | Low barrier, non-engineers can write, rich formatting | Decoupled from code changes, so the fastest to rot; ownership often unclear | Cross-team process, product notes, meeting notes |
| In-repo Markdown (Google's pick) | Changes in the same CL as code, same review and owners, full history | Hard for non-engineers to contribute; limited layout; needs a renderer | READMEs, API usage, on-call runbooks, guides close to code |
| Code comments | Closest to the code; hardest to ignore when the function changes | Local only; comments that restate the code are noise | Function / class contracts, "why it's written this way" |
Table 2 · Five doc types: who reads them, what they optimize, the usual pitfall
| Type | Main reader | Optimize for | Usual pitfall |
|---|---|---|---|
| Reference / comments | Seekers, API customers | Accuracy, completeness | Restating what the code does instead of its contract and edge cases |
| Design doc | Reviewers, future maintainers | Trade-offs and alternatives | Treated as a living doc long after the implementation drifted |
| Tutorial | Novices | Every step runnable | Skipped steps; assuming the environment is already set up |
| Conceptual | Stumblers | Clarity | Trying to cover everything and losing everyone |
| Landing page | Everyone | Pointing the way | Mixing on-call info with usage instructions |
Rule of thumb: the closer a doc lives to the code, and the more it is reviewed with the code, the less likely it is to lie. Content far from code (product, process) can stay in a wiki, but link to it from the README so there is only one authoritative version. A second rule is about people: the book holds that engineers should write most team-internal docs, and technical writers are best spent on docs that cross team or company boundaries, such as external API docs, where the knowledge gap between writer and reader is largest.
"Docs as code" is now mainstream: GitHub repos' README and docs/ folders, Python docstrings with Sphinx, Rust's cargo doc with doc examples that run as tests all follow the same path: docs in the same repo, same version, same review as the code. The directory-level READMEs scattered through Google open-source projects like Chromium are the same practice. Asked in an interview or architecture review "how do you keep docs from going stale?", the strong answer is not "tidy the wiki regularly" but "docs in the repo, reviewed in the same CL as the code, with an owner and freshness reminders".
Industry evidence · publicly verifiable
① Bad docs are mostly a process problem: the payoff is downstream, the tools are elsewhere, nobody owns them.
② Core claim: docs are tightly coupled to code, so treat them like code: policies, source control, owners, review, issue tracking, periodic evaluation, no duplication.
③ Case study: GooWiki was ownerless, duplicated and stale → docs moved into code directories, rendered by g3doc, reviewed with the CL.
④ The biggest mistake is not knowing your audience: seekers vs. stumblers, customers vs. providers; write for them separately.
⑤ Five types: reference / comments, design docs, tutorials, conceptual docs, landing pages, each with one job.
⑥ Three reviews: technical (is it right), audience (can a reader follow), writing (is it consistent).
⑦ Answer the 5 Ws up front; completeness, accuracy and clarity rarely coexist, so each doc serves one purpose.
⑧ Docs expire: record a freshness date, remind owners when it lapses, deprecate or delete what no longer applies.
⑨ Pitfalls: more isn't better; good code doesn't replace contracts and the "why"; in-repo docs still need owners and reviews.