Changing Fearlessly

To approach change fearlessly, you need the right support. In programming that primarily comes from automated tests and a great source control system. The first lets you know if you’ve broken something, the second lets you step back in time to fix it. Combined, they allow you to really attack the code base – deleting swags of code and refactoring with abandon.

There’s a golden rule though: only change one thing at a time. Even if you have the mental ability to keep track of willy nilly changes all over the place, your tools, particularly souce control, won’t. That’s fine if you get everything right, but if you have made a whole bunch of unrelated changes since you last committed, unwinding the broken from the good can be a nightmare.

Sometimes you get distracted. You’re really motivated and you’re finding all this code that needs minors fixes. It’s easy to forget to commit logical chunks of work and when you finally remember, it’s too late. All that motivation may have led to some good things, but it’s created a tangled mess as well.

Some days I wake up and decide “this is crap: I’m going to fix things”. I clean up my eating, start exercising, go to bed earlier, watch less TV. Then a few weeks later, it starts to fall apart. Things have improved, but it’s too much to keep track of. I forget everything I’m meant to be doing. Or sometimes, two goals conflict (say exercise and sleep). More often than not it all falls in heap.

I’ve realized that I have to limit myself to one change at a time, to give my mental tools a fighting chance at keeping up. I have a list of changes I’d like to make and I don’t start on the next one until I’ve bedded down the current one.

But just like it’s hard to leave a bit of code broken until you finish what you’re doing, it’s hard to keep doing something that you know is keeping you in a place you don’t want to be. It takes more willpower to not start the next task than it does to complete the current one.

The effort is worth it. Although I don’t have the measurability of unit tests, or the history-rewriting of source control, sticking to a single change is letting me tweak, redefine or even drop a goal mindfully. That makes each change much less intimidating. I’m not changing my entire life, I’m just a small aspect of it. I can approach each change, fearlessly.

comments powered by Disqus