Unveiling the Complexity of Inheritance: A Study on the Impact of Inherited Code on Software Defect Prediction

Wednesday 16 April 2025


The quest for a more accurate way to predict software defects has been ongoing for decades. Software engineers and researchers have long sought to develop metrics that can help them identify areas of code that are most likely to contain errors or bugs, allowing them to focus their testing efforts and resources on those areas.


One approach to achieving this goal is the development of complexity metrics, which aim to quantify the level of complexity in a piece of software. The idea is that more complex software is more likely to contain defects, as there are more opportunities for things to go wrong. However, traditional complexity metrics have been criticized for being too simplistic and failing to take into account important factors such as inheritance and composition.


Enter the Hybrid Cyclomatic Complexity (HCC) metric, a new approach to measuring software complexity that seeks to address these limitations. The HCC metric is based on the idea of combining two types of complexity: actual complexity, which refers to the inherent complexity of the code itself, and inherited complexity, which refers to the complexity introduced by inheritance and composition.


In a recent study, researchers explored the effectiveness of the HCC metric in predicting software defects. They used three different datasets from open-source projects and found that the HCC metric performed well in identifying areas of code that were most likely to contain defects.


The study also found that the HCC metric was able to identify defects more accurately than traditional complexity metrics, such as Halstead complexity and Cyclomatic complexity. This is because the HCC metric takes into account both actual and inherited complexity, providing a more nuanced view of software complexity.


One of the key findings of the study was that the HCC metric was particularly effective in identifying defects in classes that had complex inheritance relationships. This is because the metric is able to capture the complexity introduced by inheritance and composition, which can be difficult to identify using traditional metrics.


The researchers also found that the HCC metric was not only effective in predicting software defects but also provided a more accurate view of software complexity than traditional metrics. This is because the metric takes into account multiple factors that contribute to software complexity, including inheritance and composition.


Overall, the study suggests that the Hybrid Cyclomatic Complexity metric may be a valuable tool for software engineers and researchers seeking to improve their understanding of software complexity and predict defects more accurately. By combining actual and inherited complexity, the HCC metric provides a more nuanced view of software complexity, which can help developers identify areas of code that are most likely to contain errors or bugs.


Cite this article: “Unveiling the Complexity of Inheritance: A Study on the Impact of Inherited Code on Software Defect Prediction”, The Science Archive, 2025.


Software Defects, Complexity Metrics, Hybrid Cyclomatic Complexity, Actual Complexity, Inherited Complexity, Inheritance, Composition, Software Engineering, Defect Prediction, Halstead Complexity, Cyclomatic Complexity


Reference: Laura Diana Cernau, Laura Diosan, Camelia Serban, “Unveiling Hybrid Cyclomatic Complexity: A Comprehensive Analysis and Evaluation as an Integral Feature in Automatic Defect Prediction Models” (2025).


Leave a Reply