Universidade de Coimbro
Towards human-centric software complexity metrics: a neuroscience-based approach
Abstract
dc:description.abstractUnderstandingsoftwarecomplexity isfundamental toimprovingsoftware quality,yet traditional complexity metrics often fail to capture the cognitive effort required for code comprehension. This dissertation addresses the limitations of existing metrics by introducing a neuroscience-based, human-centric approach to complexity assess ment, integrating eye tracking and electroencephalography (EEG) to measure pro grammers’ cognitive load during code understanding. Through controlled experiments, this research evaluates and compares traditional complexity metrics(e.g., McCabe’s V(g), Halstead metrics), cognitive complexity from SonarSource tools, and behavioral metrics derived from eye-tracking data, includ ing reading time and revisit patterns (NRevisit). Cognitive load measured via EEG serves as the ground truth for assessing metric accuracy. Results highlight that tra ditional static metrics, particularly V(g) and CC Sonar, often misrepresent perceived complexity, whereas gaze-based metrics, especially NRevisit, exhibit strong correla tions with EEG-measured cognitive load (ranging from 0.906 to 0.950). Furthermore, a data-driven hybrid model integrating multiple complexity metrics significantly en hances predictive accuracy (R2 = 0.8742), demonstrating the necessity of combining complementary metrics. Extending this work, a larger-scale experiment involving 62 participants and seven Java programs was combined to assess cognitive complex ity at a finer granularity. By combining region-level gaze behavior (NRevisit) with EEG-based cognitive load measurements, the study confirmed that dynamic behav ioral metrics are especially effective for novice programmers. This is also observed for advanced programmers. However, for this population it is seen that traditional static metrics remain predictive. These findings reinforce the need for personalized, expertise-aware models of code comprehension. This dissertation advances the field by bridging the gap between software com plexity assessment and cognitive neuroscience, advocating for a shift from purely static code metrics to dynamic, programmer-specific evaluation methods. The findings provide a foundation for improving complexity measurement techniques, optimizing software development workflows, and enhancing AI-assisted coding tools, ultimately fostering more maintainable and comprehensible software.
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Gao, Hao
- Advisors dc:contributor.advisor
-
- Fernando Pereira de Carvalho, Paulo
- Tong Lam, Chan-
Subjects
dc:subject × 4Rights
dc:rights- Statement dc:rights
-
- embargoedAccess
- Language dc:language.iso
- eng
Identifiers
dc:identifier.*- Dc Identifier Tid
- 101857284