Thursday, March 22, 2007

Today I finished writing and publishing my notes to the web on the testing question. This included the cyclomatic complexity drawing and listing of the basis paths as well as a testing methodology associated with these principals. Glad to have this one done. It was a piece of archeology that I have now finished. It may be applicable to some part of development today but written from the point of view of structured programming rather than OO programming it is a bit far from reality. I found the Chidamber and Kemerer metrics more pertinent to the real world. Granted these metrics are used in different manners. McCabe is used after development while Chidamber and Kemerer are used during development. Chidamber and Kemerer can be distilled into to flavors of metrics. Those that indicate a possible greater defect level and those that indicate a level of reuse. Either can be associated with defects. Defect because, you know, defects ARE defects and reuse because a well tested reused module has less defects. Did you think it would be anything else? Avoid defects. Chidamber and Kemerer are just a little closer to reality these days. If a class is complex and well tested then it finds its worth through reuse and complexity is not an issue after it had been tested to a level of trust.

McCabe is trying to say something about testing for defects and how much testing will be needed for a complex piece of code. Chidamber and Kemerer are implying that there is a little more to defects than just complexity. Complexity without a factor of reuse has little baring on defect analysis except for the first testing cycle. A microchip is very complex and I use it in very complex ways all the time with my laptop. Through reuse of the processor I become more and more trusting. Do I need to continue testing the processor even though I write new code, No. In fact nearly all people trust the processor without any tests because they feel that someone before them tested it. McCabe`s metrics in a sense always start over at ground zero. In the real world we reuse stuff. So Chidamber and Kemerer metrics are a step beyond McCabe`s and more like what we do. The question is are they accurate in respect to what they are trying to predict. See the commentary on that one...LCOM1, LCOM2, LCOM3....

Granted, reuse could be done in a structured programming environment. That reuse would be probably reuse by copy which is a nightmare in maintenance causing more defect problems. It would not be like today with inheritance/subclassing, patterns, and object repositories where reuse is a forethought in the mind of the designer. So Cyclomatic Complexity may be good for some something but it is not the complete story in todays development environments.

Had a study group meeting yesterday. They are gearing up for the final push. We start the review on Sunday. I have already started my review.