|
You want to make a programmer cringe? Whisper the word "metrics" around him/her and watch the reaction. I dislike it so much, I couldn't finish reading this article. :) What we have here, is an attempt to not measure normal programming metrics, but rather to gauge the complexity of code using a metrics system.
In this month's column, the author explains how to determine code complexity with complexity metrics and introduces his own metric, PyMetric.
Recently, I was asked to maintain some old code and test some new code. Both tasks required that I understand the code with which I was working. Most of the time, these jobs are non-trivial due to the complexity of most code. At least four items can make things complex:
* the obvious problem of understanding what is written
* what the code is supposed to do, both at the macro and micro level
* the environment in which the code is to run
* the assumptions made about each of these things
A lot of tools are available to help sort out each of these issues. Few programs out there, however, try to measure the complexity of the code. I define complexity of code as the amount of effort needed to understand and modify the code correctly. As I explain in this article, computing complexity metrics often is a highly personal task. Also, few metrics have been shown to be of real value in determining the amount of effort needed to maintain or test code.
Performance metrics measure how well a valid program executes. Profiling tools fall into this category, and many tools are available. But for maintenance metrics, there are surprising few tools. Therefore, this column concerns creating a maintenance metric tool that measures complexity. It can be used as a prototype for general tools in other languages. Full article from the Linux Journal
|