I’ve been setting aside as much time as possible recently to read Michael Feather‘s Working Effectively with Legacy Code. A large amount of our code-base for one product is very much in this court and now, unfortunately, needs dealing with. Luckily, though, the more I refactor this type of code the more I realise how much I enjoy it.
I was explaining some of the governing principals to a colleague today…
- “First you have to get your legacy code into a test harness, then you can safely alter it.”
- “However, you’ll need to alter it before you can do that.”
I have come to the conclusion that Working with Legacy code does not so much involved harnesses as muzzles. It is akin to Muzzling an Angry Dog. First, you have to sneak up to it, from behind, without making any noise or disturbing it’s environment. Then, once the muzzle is safely on you can relax and poke it as much as you like. From now on, our estimates will have a ‘Dog Muzzling’ factor added to them.
[And, no, I do not condone taunting any dog, angry or otherwise.]