Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship. Jay, G., Hale, J. E., Smith, R. K., Hale, D., Kraft, N. A., & Ward, C. 02(03):137–143.
Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship [link]Paper  doi  abstract   bibtex   
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 explanatory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear relationship 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 development 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 languages and programming paradigms.
@article{jayCyclomaticComplexityLines2009,
  title = {Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship},
  author = {Jay, Graylin and Hale, Joanne E. and Smith, Randy K. and Hale, David and Kraft, Nicholas A. and Ward, Charles},
  date = {2009},
  journaltitle = {Journal of Software Engineering and Applications},
  volume = {02},
  pages = {137--143},
  issn = {1945-3116},
  doi = {10.4236/jsea.2009.23020},
  url = {https://doi.org/10.4236/jsea.2009.23020},
  abstract = {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 explanatory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear relationship 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 development 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 languages and programming paradigms.},
  keywords = {*imported-from-citeulike-INRMM,~INRMM-MiD:c-13847288,complexity,cyclomatic-complexity,lines-of-code,nested-loops-and-conditional-structures,software-errors,software-uncertainty},
  number = {03}
}
Downloads: 0