BOOK DEEP READ · CONTINUOUS DELIVERY · CH 13

Managing Components and Dependencies

Continuous Delivery · Ch 13 · Jez Humble & David Farley · 2010

中文 →

What is this chapter about?

The apps on your phone ship a new version most weeks. But they are not written by one person — they are written by dozens or hundreds of people all editing the same pile of code at the same time. Chapter 13 of Continuous Delivery asks the obvious question: while everyone is mid-surgery, how do you keep the thing ready to ship every single day? The answer has two halves — how to finish a big renovation without closing down, and what to do when the codebase grows too big for one build.

An analogy

Picture replacing the entire kitchen of a restaurant that stays open for business every day. You cannot hang a "Closed for renovation — back in three months" sign; the customers would be gone. That is the whole chapter: how to swap the kitchen while still serving lunch, and — when the kitchen grows too big for one crew — how to split it into separate stalls without losing track of whether a full table's order still comes out together.

Why the old way hurt

The old way was to go into seclusion: send a team off to work on it alone, and bring the work back three months later. It sounds reasonable and it is a disaster. Everyone else kept editing too, so by the time you come back the two versions no longer line up. Just reconciling them takes several late nights, and when it is done nobody will swear the thing still runs. The longer you stay apart, the worse the reunion — and it does not get twice as bad, it gets many times worse.

Trick one: build a serving hatch first

If ripping the kitchen out and putting a new one back is what hurts, then don't rip it out. Instead, build a serving hatch in front of the old kitchen: from now on the dining room orders through the hatch and never cares who is cooking behind it. Once the hatch is up, you can calmly assemble the new kitchen behind it while the restaurant stays open and the old kitchen keeps cooking. When the new one can produce every dish, you connect the hatch to it; after a while, once you are sure, you tear the old kitchen out.

The beauty of it: at no point is the place ever "closed for renovation." After every small step, you can open the doors again tomorrow.

Trick two: separate stalls, and the "wrong screws" problem

When the kitchen is too big for one crew, split it into stalls that stock and cook for themselves. The benefit is concrete: changing one stall's menu no longer disturbs the whole restaurant.

The cost is that nobody is watching whether a full table's order comes out complete anymore. Worse is the wrong-screws problem: stall A's recipe calls for version 2.0 of a particular sauce, stall B's calls for 1.0 — and there is only room for one jar on the shelf. That is what programmers grumble about as dependency hell. The chapter's rule is blunt: the recipe must name the exact version of the sauce, never "whatever the newest jar is" — otherwise a dish you could cook today mysteriously fails tomorrow, and you changed nothing. Then you add a pass counter whose only job is to check that this particular set of stalls, at these particular versions, really does produce one complete table.

The cost you cannot dodge

Once you split into stalls, the total hours the kitchen spends working usually goes up, not down. What you bought is "changing one stall does not disturb the rest," and somebody still has to pay for all that extra checking. Which is why the chapter keeps saying: don't split until you truly have to.

Remember this

To keep software that people edit daily always ready to ship: don't go into seclusion for a big renovation — build a serving hatch and swap things out in place. Only split into stalls once the kitchen is genuinely too big, and when you do, pin the exact version of every part and add a gate whose sole job is checking that this combination of versions actually works together.

Want the mechanisms, the notation and the diagrams? → Switch to the deep read