Title :
Reading Beside the Lines: Indentation as a Proxy for Complexity Metric
Author :
Hindle, Abram ; Godfrey, Michael W. ; Holt, Richard C.
Author_Institution :
Waterloo Univ., Waterloo, ON
Abstract :
Maintainers face the daunting task of wading through a collection of both new and old revisions, trying to ferret out revisions which warrant personal inspection. One can rank revisions by size/lines of code (LOC), but often, due to the distribution of the size of changes, revisions will be of similar size. If we can´t rank revisions by LOC perhaps we can rank by Halstead´s and McCabe´s complexity metrics? However, these metrics are problematic when applied to code fragments (revisions) written in multiple languages: special parsers are required which may not support the language or dialect used; analysis tools may not understand code fragments. We propose using the statistical moments of indentation as a lightweight, language independent, revision/diff friendly metric which actually proxies classical complexity metrics. We have extensively evaluated our approach against the entire CVS histories of the 278 of the most popular and most active SourceForge projects. We found that our results are linearly correlated and rank-correlated with traditional measures of complexity, suggesting that measuring indentation is a cheap and accurate proxy for code complexity of revisions. Thus ranking revisions by the standard deviation and summation of indentation will be very similar to ranking revisions by complexity.
Keywords :
software engineering; software metrics; code fragments; complexity metrics; indentation; size/lines of code; Code standards; Encapsulation; History; Inspection; Java; Lab-on-a-chip; Merging; Software maintenance; Software standards; Software tools; Whitespace; change metric; complexity; indentation; maintainability;
Conference_Titel :
Program Comprehension, 2008. ICPC 2008. The 16th IEEE International Conference on
Conference_Location :
Amsterdam
Print_ISBN :
978-0-7695-3176-2
DOI :
10.1109/ICPC.2008.13