TL;DR

When we make two changes at once, there are four possible outcomes, and three of them are bad!

Atomic Changes

Presumably every code change we make has a idea behind it: to improve the code, either in operation or design. Generally, a single idea involves more than one line of code. We have to declare the temp, and then change other lines to use it. We add a parameter to a method and have to change all the callers. Etc.

But those multiple lines of text change are all part of the single idea: make it work, or look, better. It’s the smallest set of changes that won’t break the code. Let’s call that an Atomic Change.

Possible Outcomes

When we make one Atomic Change, there are two possible outcomes: it will accomplish what we want, or it won’t. (These are, we hope, not equally probable.)

When we see something else that needs to be changed, it might be a Really Good Idea. But it’s not part of our current Atomic Change. It’s part of its own Atomic Change. If we make two Atomic Changes together, the possibilities are that both work, or A works and B doesn’t, or B works and A doesn’t, or neither A nor B work.

When we make two changes at once, there are four possible outcomes, and three of them are bad!

Unnecessary Details

Just to hammer more nails into this, let’s do some math. To make it simple, assume you’re me, and your Atomic Changes therefore work maybe 7 out of 10 times. If I do the one, my chance of success is 0.7. My expected payoff is 0.7 times the value of the change.

If I make two changes at once, my chance of success is down to about 0.5, 0.49 in fact. My payoff is less than half of what I set out to gain. Three changes, of course, take me down to just a bit better than a 1 in 3 chance of success.

If that were not damning enough, my chance of needing to debug, or at least understand what went wrong, goes up with the other side of the equation from 3 out of 10 times, to 5 out of 10, to almost 7 out of 10.

Worse yet, of course, with more code in play, figuring out what’s wrong is more difficult, because things can be wrong in combination. If I make three changes before testing, more than half the time, there will be more than one defect injected. Makes reasoning difficult, makes debugging difficult.

Let’s do one Atomic Change at a time, OK?

TL;DR

When we make two changes at once, there are four possible outcomes, and three of them are bad!