Ivan Mitev In The Software Trenches

Technology weblog on .NET development and other things that make the world go round

December 08, 2005

Lines of Code

Martin Fowler has explained well why the LOC metric is not a good measure of productivity. Mark Miller also does not have a high opinion of it and emphasize on the fact that it all comes down to maintainability.

I personally think that:
  • LOC metric has no value of its own, but if combined with other metrics can provide some interesting data. If your LOC grows proportionally with the features (or feature points) count, this might show that you are not reusing enough code. Generally, given that the feature set is the same, the less code the better.
  • Great LOC count might also mean that you are reinventing the wheel, instead of using available libraries. Statistically, the more LOC you have the more defects you might produce. You don't want that, right?
  • I don't see what is so special about LOC. In fact, statements count is a more objective metric.
  • Complexity can not be measured in LOC, some code is just far more complex than other. You know, in my current project 1/3 of the codebase is actually automatically generated by xsd.exe (typed datasets stuff), so how can it fit in a LOC measurement?
I can go on and on, but I think I made my point clear! Better keep low values for my weblog LOC (Lines Of Common sense) :)

UPDATE: A quote from Edsger Dijkstra found here:
If we wish to count lines of code, we should not regard them as lines produced but as lines spent.