Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even sub...Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even substituting LOC for CC. However, from an empirical standpoint the relationship of CC to LOC is still an open one. We undertake the largest statistical study of this relationship to date. Employing modern regression techniques, we find the linearity of this relationship has been severely underestimated, so much so that CC can be said to have absolutely no explana-tory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear rela-tionship that holds across programmers, languages, code paradigms (procedural versus object-oriented), and software processes. Linear models are developed relating LOC and CC. These models are verified against over 1.2 million randomly selected source files from the SourceForge code repository. These files represent software projects from three target languages (C, C++, and Java) and a variety of programmer experience levels, software architectures, and de-velopment methodologies. The models developed are found to successfully predict roughly 90% of CC’s variance by LOC alone. This suggest not only that the linear relationship between LOC and CC is stable, but the aspects of code complexity that CC measures, such as the size of the test case space, grow linearly with source code size across lan-guages and programming paradigms.展开更多
Large-scale object-oriented(OO) software systems have recently been found to share global network characteristics such as small world and scale free,which go beyond the scope of traditional software measurement and ...Large-scale object-oriented(OO) software systems have recently been found to share global network characteristics such as small world and scale free,which go beyond the scope of traditional software measurement and assessment methodologies.To measure the complexity at various levels of granularity,namely graph,class(and object) and source code,we propose a hierarchical set of metrics in terms of coupling and cohesion-the most important characteristics of software,and analyze a sample of 12 open-source OO software systems to empirically validate the set.Experimental results of the correlations between cross-level metrics indicate that the graph measures of our set complement traditional software metrics well from the viewpoint of network thinking,and provide more effective information about fault-prone classes in practice.展开更多
文摘Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even substituting LOC for CC. However, from an empirical standpoint the relationship of CC to LOC is still an open one. We undertake the largest statistical study of this relationship to date. Employing modern regression techniques, we find the linearity of this relationship has been severely underestimated, so much so that CC can be said to have absolutely no explana-tory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear rela-tionship that holds across programmers, languages, code paradigms (procedural versus object-oriented), and software processes. Linear models are developed relating LOC and CC. These models are verified against over 1.2 million randomly selected source files from the SourceForge code repository. These files represent software projects from three target languages (C, C++, and Java) and a variety of programmer experience levels, software architectures, and de-velopment methodologies. The models developed are found to successfully predict roughly 90% of CC’s variance by LOC alone. This suggest not only that the linear relationship between LOC and CC is stable, but the aspects of code complexity that CC measures, such as the size of the test case space, grow linearly with source code size across lan-guages and programming paradigms.
基金Supported by the National Grand Fundamental Research 973 Program of China under Grant No.2007CB310800the National Natural Science Foundation of China under Grant Nos.60873083 and 60803025+2 种基金the Research Fund for the Doctoral Program of Higher Education of China under Grant No.20090141120022the Natural Science Foundation of Hubei Province of China under Grant Nos.2008ABA379 and 2008CDB351the Fundamental Research Funds for the Central Universities of China under Grant No.6082005
文摘Large-scale object-oriented(OO) software systems have recently been found to share global network characteristics such as small world and scale free,which go beyond the scope of traditional software measurement and assessment methodologies.To measure the complexity at various levels of granularity,namely graph,class(and object) and source code,we propose a hierarchical set of metrics in terms of coupling and cohesion-the most important characteristics of software,and analyze a sample of 12 open-source OO software systems to empirically validate the set.Experimental results of the correlations between cross-level metrics indicate that the graph measures of our set complement traditional software metrics well from the viewpoint of network thinking,and provide more effective information about fault-prone classes in practice.