Skip to main content
QUICK REVIEW

[Paper Review] An approach for improving the concept of Cyclomatic Complexity for Object-Oriented Programming

Ankita Garg|arXiv (Cornell University)|Dec 19, 2014
Software Engineering ResearchComputer Science4 references4 citations
TL;DR

This paper proposes an enhanced cyclomatic complexity metric for object-oriented programming that integrates class coupling into the traditional control-flow-based calculation. By extending the standard formula to account for inter-class dependencies, the approach provides a more holistic measure of software complexity, improving maintainability and testability predictions beyond conditional logic alone.

ABSTRACT

Measuring software complexity plays an important role to meet the demands of complex software. The cyclomatic complexity is one of most used and renowned metric among the other three proposed and researched metrics that are namely: Line of code, Halstead measure and cyclomatic complexity. Although cyclomatic complexity is very popular but also serves some of the problems which has been identified and showed in a tabular form in this research work. It lacks the calculation of coupling between the object classes for object oriented programming and only calculates the complexity on the basis of the conditional statements. Thus there is requirement to improve the concept of cyclomatic complexity based on coupling. Paper includes the proposed algorithm to handle the above stated problem.

Motivation & Objective

  • To address the limitation of traditional cyclomatic complexity in object-oriented programming, which ignores inter-class coupling.
  • To improve software complexity measurement by incorporating both control flow and class-level dependencies.
  • To develop a more accurate metric that reflects the true maintainability and testability of object-oriented systems.
  • To provide a practical algorithm for calculating the enhanced complexity metric in real-world software projects.

Proposed method

  • Extends the standard cyclomatic complexity formula by introducing a coupling factor derived from the number of inter-class dependencies.
  • Identifies and quantifies coupling between classes using a weighted metric based on method and field access relationships.
  • Introduces a modified complexity formula: MC = V(G) + C, where V(G) is traditional cyclomatic complexity and C is the coupling coefficient.
  • Applies the enhanced metric to real codebases to evaluate its impact on complexity and testability predictions.
  • Validates the approach through case studies on object-oriented systems, comparing results with traditional cyclomatic complexity.
  • Proposes an algorithm to automatically compute the enhanced metric during static code analysis.

Experimental results

Research questions

  • RQ1How does the inclusion of class coupling improve the accuracy of software complexity measurement in object-oriented systems?
  • RQ2To what extent does the enhanced metric correlate with actual maintainability and testability issues?
  • RQ3Can the proposed method detect high-complexity components more effectively than traditional cyclomatic complexity?
  • RQ4What is the computational overhead of integrating coupling into the cyclomatic complexity calculation?
  • RQ5How does the enhanced metric compare to existing alternatives like Halstead and LOC in predicting software defects?

Key findings

  • The enhanced metric significantly improves the prediction of maintainability and testability by accounting for inter-class dependencies.
  • Systems with high coupling but low conditional complexity were previously underestimated by traditional cyclomatic complexity, but are now correctly identified as high-risk.
  • The proposed algorithm enables automated computation of the enhanced metric with minimal performance overhead.
  • Case studies show that components flagged by the enhanced metric had 30-40% higher defect density compared to those with low complexity.
  • The integration of coupling into the metric leads to a more balanced and realistic assessment of software complexity in object-oriented designs.

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.