A Novel OO-Based Code Complexity Metric
摘要
This paper introduces a novel object-oriented cognitive-based complexity metric termed Combined Weighted Complexity (CWC), designed to compute the complexity of object-oriented programs at the program statement level. The principal aim of this research is to provide a more granular and cognitively aware metric that accurately reflects the complexity of object-oriented programs, addressing a significant gap in existing metrics which often overlook detailed granularity and cognitive load factors. The primary challenge tackled by the CWC metric is the need to measure complexity comprehensively by considering eight specific factors: nesting level of control structures, type of control structures, compound conditions, try-catch blocks, threads, pointers, references, and dynamic memory access. By quantifying these intricate coding elements and their interactions, the proposed metric provides a robust framework for developers to assess, manage, and optimize code complexity. The paper demonstrates the application of the CWC metric through a detailed computational example, highlighting its effectiveness in identifying complex code segments. The results indicate that the CWC metric not only enhances understanding of code complexity but also supports systematic improvement of software quality by providing actionable insights into code structure and behavior.