首页    期刊浏览 2024年12月03日 星期二
登录注册

文章基本信息

  • 标题:Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship
  • 本地全文:下载
  • 作者:Graylin JAY ; Joanne E. HALE ; Randy K. SMITH
  • 期刊名称:Journal of Software Engineering and Applications
  • 印刷版ISSN:1945-3116
  • 电子版ISSN:1945-3124
  • 出版年度:2009
  • 卷号:2
  • 期号:3
  • 页码:137-143
  • DOI:10.4236/jsea.2009.23020
  • 出版社:Scientific Research Publishing
  • 摘要: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.
  • 关键词:Software Complexity; Software Metrics; Cyclomatic Complexity
国家哲学社会科学文献中心版权所有