Book Deep-Read · Software Engineering at Google · Chapter 22

Large-Scale Changes

Software Engineering at Google · Ch 22 · Large-Scale Changes · Hyrum Wright · 2020

中文 →

What is this chapter about?

A big company's software is a huge pile of files written by tens of thousands of engineers together. Suppose one "old part" that everybody uses has to be swapped for a new one — and it's used in hundreds of thousands of places. How do you swap it? That's this chapter: how to safely pull off a "replace it everywhere" job in an enormous codebase that someone is always editing.

A strange thing first

You'd think that the bigger the company and the better its tools, the more you can change in one go. Google found the opposite: the bigger the codebase and the more people in it, the smaller the change you can actually make and hand in all at once. So they gave up on "do it all at once" and switched to "split it into thousands of small changes and feed them in gradually."

Why the old way is hard

Picture replacing the water pipes in a tower block with thousands of flats. Option one: post a notice telling every flat to replace their own pipes — nobody wants to pay for it, some will drag their feet forever, and every flat has to learn from scratch how it's done. Option two: pick a weekend, shut off the water for the whole building and swap everything at once — but there is never a moment when nobody is using water, and if something leaks halfway through, good luck finding which of thousands of joints wasn't tightened.

How it works, intuitively

What it buys you / how to choose

With this ability, many decisions that used to be "set in stone forever" — what a function is called, where a part lives — become ones you can take back. For a few dozen edits, just do them by hand; for hundreds or thousands, learn to use tools that do it in bulk. The honest cost: all of this rests on thorough automatic checks and a uniform tooling environment — old code without good tests is code nobody dares touch.

One line to remember

Don't expect to make a huge change in one shot: split it into many small changes that can each be checked, delivered and undone on their own, let machines do the heavy work, and let the people who know the system own it.

Want to see why atomic commits lose to scale, how Rosie shards and mails changes, how the TAP "train" saves test runs, the real numbers behind the scoped_ptr migration, and the trade-offs of global approvers and "cattle vs. pets"? → Switch to the deep read