August 15, 2006

...Learn TDD with Codemanship

Code Half-Life

Here's a quick thought about the life expectancy of software...

From the inception of a new software product, plot two pieces of information as time marches on - the size of the code as it grows (e.g., in thousands of lines of code), and the size of the team required to develop and support the code. (You can get some of this information if you trawl back through previous versions of the code in your SCC system).

What tends to happen on most projects - no, actually, on all projects that I'm aware of - is that the code grows very rapidly to begin with, and then as time goes on that growth slows down until the software sort of reaches a plateau and doesn't really get much bigger.



While this is going on, teams have a tendency to grow. You might start out with a handful of developers bashing out code in a fairly informal manner, but as deadlines loom, managers have a tendency for hiring more people - even though, like the idiot who puts diesel in a petrol engine - they know they really shouldn't. And then the software goes through its first release to the end users, and yet more people are added to support those users and to maintain the software and add new features for the next inevitable release.



The effect of all this is that, over time, the cost of a line of code goes up and up and up. And that effect accelerates as the code growth starts to slow down and the team grows even bigger.

At some arbitrary point in the timeline, the cost of a line of code is double what it was at some earlier arbitrary point. The elapsed time between these two points could be called the code half-life. And at some point in the future, the cost of a line of new code will be so expensive as to be prohibitive. At that point, your codebase is effectively petrified and it's time to start thinking about a replacement.



Actually, it was time to start thinking about the replacement much earlier than that, and the code half-life might be a useful tool for indicating when this might be. It might also be useful for identifying code that is highly radioactive.
Posted 14 years, 4 months ago on August 15, 2006