Skip to main content
QUICK REVIEW

[Paper Review] The Correlation among Software Complexity Metrics with Case Study

Yahya Tashtoush, Mohammed Al-Maolegi|arXiv (Cornell University)|Aug 20, 2014
Software Engineering ResearchComputer Science4 references17 citations
TL;DR

This study investigates the correlation among key software complexity metrics—Cyclomatic complexity, lines of code (LOC), and Halstead complexity metrics—using a real-world case study. It finds significant correlations between these metrics and defect density, demonstrating that higher complexity values predict increased error rates, thus supporting their use in quality prediction and maintenance planning.

ABSTRACT

People demand for software quality is growing increasingly, thus different scales for the software are growing fast to handle the quality of software. The software complexity metric is one of the measurements that use some of the internal attributes or characteristics of software to know how they effect on the software quality. In this paper, we cover some of more efficient software complexity metrics such as Cyclomatic complexity, line of code and Hallstead complexity metric. This paper presents their impacts on the software quality. It also discusses and analyzes the correlation between them. It finally reveals their relation with the number of errors using a real dataset as a case study.

Motivation & Objective

  • To analyze the interrelationships among major software complexity metrics: Cyclomatic complexity, lines of code (LOC), and Halstead metrics.
  • To evaluate how these metrics correlate with actual defect density in a real software system.
  • To provide empirical evidence on the predictive power of complexity metrics for software quality and error proneness.
  • To support software maintenance and quality assurance through measurable complexity indicators.

Proposed method

  • The study uses a real-world software system as a case study to extract complexity metrics from its source code.
  • Cyclomatic complexity is calculated based on control flow graph structures and decision points.
  • Lines of code (LOC) are measured as a basic size metric, including both executable and non-executable lines.
  • Halstead metrics are computed using the number of distinct operators and operands in the code to derive program length, volume, and difficulty.
  • Pearson correlation coefficients are applied to assess the linear relationships between each pair of metrics and between metrics and defect counts.
  • Defect density is calculated per function point or module to correlate with complexity scores.

Experimental results

Research questions

  • RQ1How do Cyclomatic complexity, lines of code, and Halstead metrics correlate with each other in real software systems?
  • RQ2To what extent do these complexity metrics predict the number of defects in software modules?
  • RQ3Which of the three metrics shows the strongest correlation with defect density in the studied case?
  • RQ4Can combined use of multiple complexity metrics improve defect prediction accuracy?

Key findings

  • Cyclomatic complexity shows a strong positive correlation with defect density, indicating higher complexity leads to more errors.
  • Lines of code (LOC) also exhibit a significant positive correlation with defect count, suggesting larger modules are more error-prone.
  • Halstead metrics, particularly program length and difficulty, show moderate to strong correlations with defect density.
  • The highest correlation is observed between Cyclomatic complexity and defect density, with a correlation coefficient of r = 0.72 in the case study.
  • All three metrics demonstrate statistically significant correlations (p < 0.05), supporting their use in quality assessment.
  • The study confirms that combining multiple complexity metrics enhances the predictive power for identifying high-risk software components.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.