Extending Cognitive Code Complexity Measure to Include Service Call Impact
摘要
The measurement of software complexity is critical for assessing the maintainability and efficiency of modern applications. Traditional complexity models, such as the Cognitive Code Complexity metric, focus on structural elements like control flow and recursion but do not account for service interactions. In real-world systems, frequent and concurrent service calls to APIs, databases, and cloud services introduce significant cognitive and operational complexity. These factors are not adequately captured by existing models. To address this gap, this study proposes the Service Call Complexity Metric as an extension to the Cognitive Code Complexity metric. Service Call Complexity Metric quantifies complexity based on the frequency and concurrency of service interactions. A prototype tool using the Service Call Complexity Metric was developed and tested. Results showed that incorporating service calls provides a clearer and more comprehensive view of software complexity. Functions with high levels of service interaction exhibited notably elevated complexity scores, highlighting the practical importance of the proposed enhancement for modern software systems.