Applying the ABC metric to C, C++, and Java

Jerry Fitzpatrick · Cambridge University Press eBooks · 2000

Point::~AbstractPoint(void) { // does nothing } The LOC value for this destructor is three, which suggests the code is actually performing some action. On the other hand, the ABC vector components and magnitude are all zero, signifying that the destructor does not contribute directly to program size. This does not necessarily imply, however, that the destructor is not needed. Perhaps the most important aspect of the ABC metric is that it seems to judge a program’s size the way that most developers do. For research purposes, as set of C++ class methods was ranked by eighteen developers who had little familiarity with LOC and no familiarity with ABC. Their rankings shows a significantly higher correlation to ABC magnitudes than to LOC. The result is not too surprising since LOC is merely a convenient measure, not a well- constructed one. No one is fooled into thinking that there is a greater amount of source code if it is spread out over several lines. Likewise, developers do not normally estimate size by assessing the number of operators and operands as software science would suggest. Conclusion The ABC metric overcomes many of the limitations of the LOC metric. It has a theoretical foundation, is style independent, and has useful mathematical properties. Furthermore, the ABC counting rules for C, C++, and Java are defined to allow accurate cross-language comparisons, thereby enhancing the applicability of the metric. Preliminary research suggests that the ABC metric provides program size measurements similar to those given by professional developers. Because of its consistency, the ABC metric should provide better estimates of project development time and program reliability. Specifically, it should provide more accurate comparisons of projects created by different individuals and businesses. Although the ABC is a promising metric, further research is needed to assess its viability for larger programs. The metric must be compared to LOC and other measures to determine the extent of its benefits. The relationship between the ABC components should be explored further. Finally, the hypothesis regarding size and cohesion should be confirmed and the relationship between the two defined. Because ABC counting is too tedious and error-prone to perform by hand, I am developing programs for Windows 95/NT that will automate the process. When completed, you’ll be able to download them from the website http://www.redmtn.com [26 Jun 2002: these utilities are no longer available]. I encourage you to try ABC instead of LOC. I’d be interested in your results, ideas, and comments. References 1. Halstead, M.H. Elements of Software Science, Elsevier North Holland 1977. 2. Fenton, N. Software Metrics, Chapman & Hall 1991. Copyright 1997 by Jerry Fitzpatrick. All rights reserved. Originally published in C++ Report, June 1997.

Read the paper · More papers on PaperTik