跳至主導覽 跳至搜尋 跳過主要內容

Complementarity in software code complexity metrics

  • Gao Hao
  • , Haytham Hijazi
  • , Júlio Medeiros
  • , João Durães
  • , Chan Tong Lam
  • , Paulo De Carvalho
  • , Henrique Madeira

研究成果: Article同行評審

3 引文 斯高帕斯(Scopus)

摘要

Despite the widely accepted notion that software metrics like classic McCabe cyclomatic complexity (V(g)) or those provided by tools such as SonarQube (CC Sonar) represent code understandability from the perspective of a typical programmer, the accuracy of these metrics in reflecting perceived code understandability remains uncertain. This paper investigates the complementarity of code complexity metrics using a data-driven approach that incorporates linear and non-linear regression models. To evaluate the complementarity of code metrics, a controlled experiment was conducted with 35 programmers of varying expertise, who read and comprehended a set of programs with varying levels of complexity. The complexity of the programs was initially measured using established metrics, and the cognitive load (CL) of the programmers was captured through electroencephalography (EEG) while they understood the code. Given the controlled conditions of the experiment (free from interruptions or distractions), the cognitive load measured by EEG accurately indicates the mental effort involved in understanding the code. The study found that Halstead metrics (Effort and Difficulty) have a higher correlation with EEG-measured cognitive load (Spearman correlation rs=0.66 and 0.64, respectively) compared to V(g) (rs=0.33) and CC Sonar (rs=0.35). However, no single metric fully captured the complexity perceived by programmers, emphasizing the need for complementary metrics. The results of combining multiple metrics through data-driven regression models significantly improved predictive accuracy, with Gaussian Process Regression achieving a maximum R² of 0.8742. These findings suggest that bridging the gap between static complexity metrics and the cognitive demands of code comprehension requires a hybrid approach that integrates complementary metrics, offering a more holistic view of code understandability.

原文English
文章編號112679
期刊Journal of Systems and Software
232
DOIs
出版狀態Published - 2月 2026

指紋

深入研究「Complementarity in software code complexity metrics」主題。共同形成了獨特的指紋。

引用此