Chapter 28. Reversible Structure Changes
What’s the difference between a bad haircut and a bad tattoo? The bad haircut grows out, but the bad tattoo is forever (well, not forever forever, but it’s way harder to undo).
How are structure changes different from behavior changes? One property relevant to tidying first is that structure changes are generally reversible. You extract a helper function and you don’t like it? Inline it. It’s like that helper never existed.
Contrast this with a regrettable behavior change. Let’s say you’ve sent out 100,000 tax notices with the wrong number on them. Now what? Well, it’ll cost you plenty to fix them. The damage to your reputation may be permanent. If only you’d caught that problem five minutes before you sent the notices instead of five minutes after.
In general, we should treat reversible decisions differently than irreversible decisions. There’s great value in reviewing, double-checking, triple-checking irreversible decisions. The pace should be slow and deliberate. Even if there is a great upside to the decision, there is also potentially a great downside if we get it wrong. Yes, we want the upside, but even more we want to avoid the downside.
How about reversible decisions? Most software design decisions are easily reversible. There is some upside to making them (making behavior changes easier, as we’ve seen throughout this book). But there’s really not much downside, because we can so easily reverse a decision if it turns out to be wrong. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access