Assessing the Construct Validity of Object-Oriented, Class-Level Code Quality Metrics
Hera Arif, Miikka Kuutila, Paul Ralph
Abstract
Background: Code quality metrics are intended to measure latent properties of software source code. Although numerous code metrics have been proposed and used, their construct validity is rarely evaluated. Thus, the extent to which code metrics actually measure what they claim to measure is often unclear. Aim: Drawing from modern measurement theory, we investigate the construct validity of common class-level, object-oriented code quality metrics by identifying their factor structure using Exploratory Factor Analysis (EFA). The metrics were extracted from the Apache Maven project by three software tools: Designite, JHawk, and Understand. The factor structure was later verified using Confirmatory Factor Analysis (CFA) on 22 randomly selected open source projects meeting a predetermined eligibility criteria. Results: 24 code quality metrics that correspond to six constructs: Cohesion, In-Coupling, Out-Coupling, Size, Sub-Inheritance (related to subclasses), and Sup-Inheritance (related to superclasses) were revealed in the underlying factor structure. Ten metrics did not correspond to any known dimension of software quality and were removed in the EFA. Ten additional metrics exhibited low loadings in the CFA, suggesting their removal from the final measurement model. Size, Cohesion, Inheritance, and Coupling were the constructs retained, with subcategories identified for Inheritance and Coupling. Conclusions: Our results strongly support the construct validity of 24 code quality metrics. Coupling and Inheritance are revealed as multidimensional constructs, since they require measuring two different concepts, revealed as sub-categories in our analysis, and Complexity may be better explored in a multilevel model. Overall, our study demonstrates the value of applying modern measurement theory and latent variable modeling in validating software code quality metrics.
Create a lesson
Related papers
Spotlights: Discovering Improvement Opportunities in Software Repositories
Udi Barzelay, Ophir Azulai, Idan Friedman et al.
AdaRepair-Mem: Adaptive Experience Orchestration for Repository-Level Program Repair
Z. C. Luo, J. C. Guo, W. J. He et al.
HapCiD: Detecting API-related Compatibility Issues in OpenHarmony Apps
Daihang Chen, Yonghui Liu, Mingyi Zhou et al.
EviRCA: Decoupling Evidence Extraction from Reasoning for Microservice Root-Cause Analysis
Yuhao Wang, Zhen Qin, Xingliang Wang et al.
A Closed-Loop Control Architecture for Reliable Constraint Satisfaction in LLM Text Generation
Quan Zhou, Shahbaz Siddeeq, Mika Saari et al.
BA-TRACE: Boundary-Aware Trace Reconstruction for Scenario-Based Evaluation of Mixed AUTOSAR Adaptive and ROS 2 Vehicular Embedded Systems
Shunsuke Ito, Ryudai Iwakami, Hiroyuki Hanyu et al.