Table of Contents
Fetching ...

Evaluating the Dependency Between Cyclomatic Complexity and Response For Class

Maxim Stavtsev, Yegor Bugayenko

TL;DR

The authors' findings indicate a strong Pearson correlation of 0.79 between the cumulative McCabe's Cyclomatic Complexity (CC) of all class methods and the number of methods, a metric known as Response for Class (RFC).

Abstract

In object-oriented programming, it is reasonable to hypothesize that smaller classes with fewer methods are less complex. Should this hypothesis hold true, it would be advisable for programmers to design classes with fewer methods, as complexity significantly contributes to poor maintainability. To test this assumption, we analyzed 862,517 Java classes from 1,000 open GitHub repositories. Our findings indicate a strong Pearson correlation of 0.79 between the cumulative McCabe's Cyclomatic Complexity (CC) of all class methods and the number of methods, a metric known as Response for Class (RFC).

Evaluating the Dependency Between Cyclomatic Complexity and Response For Class

TL;DR

The authors' findings indicate a strong Pearson correlation of 0.79 between the cumulative McCabe's Cyclomatic Complexity (CC) of all class methods and the number of methods, a metric known as Response for Class (RFC).

Abstract

In object-oriented programming, it is reasonable to hypothesize that smaller classes with fewer methods are less complex. Should this hypothesis hold true, it would be advisable for programmers to design classes with fewer methods, as complexity significantly contributes to poor maintainability. To test this assumption, we analyzed 862,517 Java classes from 1,000 open GitHub repositories. Our findings indicate a strong Pearson correlation of 0.79 between the cumulative McCabe's Cyclomatic Complexity (CC) of all class methods and the number of methods, a metric known as Response for Class (RFC).
Paper Structure (7 sections, 3 figures, 3 tables)

This paper contains 7 sections, 3 figures, 3 tables.

Figures (3)

  • Figure 1: Evidence of right-skewness in metrics. The histograms display the frequency distribution of metrics. Each metric's value is plotted on the x-axis, while the corresponding number of classes is presented on the y-axis. This visualization clearly depicts a right-skewed tendency, signifying a predominance of classes with lower value of metrics within the data.
  • Figure 2: Augmented variability in Cyclomatic Complexity associated with increased Response for Class. Box plots depicts the range and median of CC for classes at increasing levels of RFC. Outliers are denoted as individual points. The analysis shows an upward trend in CC variability as RFC grow, underlining the increasing complexity in larger classes.
  • Figure 3: High data density in lower ranges of Cyclomatic Complexity and Response for Class metrics. This plot highlights the commonality of simpler classes within the dataset.