An Empirical Validation of Cognitive Complexity as a Measure of Source Code Understandability
Not on the map. Why?
Abstract (arXiv)
Background: Developers spend a lot of their time on understanding source code. Static code analysis tools can draw attention to code that is difficult for developers to understand. However, most of the findings are based on non-validated metrics, which can lead to confusion and code, that is hard to understand, not being identified. Aims: In this work, we validate a metric called Cognitive Complexity which was explicitly designed to measure code understandability and which is already widely used due to its integration in well-known static code analysis tools. Method: We conducted a systematic literature search to obtain data sets from studies which measured code understandability. This way we obtained about 24,000 understandability evaluations of 427 code snippets. We calculated the correlations of these measurements with the corresponding metric values and statistically summarized the correlation coefficients through a meta-analysis. Results: Cognitive Complexity positively correlates with comprehension time and subjective ratings of understandability. The metric showed mixed results for the correlation with the correctness of comprehension tasks and with physiological measures. Conclusions: It is the first validated and solely code-based metric which is able to reflect at least some aspects of code understandability. Moreover, due to its methodology, this work shows that code understanding is currently measured in many different ways, which we also do not know how they are related. This makes it difficult to compare the results of individual studies as well as to develop a metric that measures code understanding in all its facets.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). First posted on arXiv 24 Jul 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 2; 2025: 2; 2026: 3.
7 papers.
- 2024Reasoning Through Execution: Unifying Process and Outcome Rewards for Code Generationcited by 21
- 2025Security and Quality in LLM-Generated Code: A Multi-Language, Multi-Model Analysiscited by 18
- 2026Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metricscited by 2
- 2025LogicIF: Towards Complex Logic Instruction Followingcited by 1
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analyticscited by 0
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generationcited by 0
- 2026Complexity-Aware Evaluation of LLM Comprehensioncited by 0
- 2026Complexity-Aware Evaluation of LLM Comprehension29 Sep 2026
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generation15 Jul 2026
- 2026Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metrics5 Jan 2026
- 2025LogicIF: Towards Complex Logic Instruction Following12 Aug 2025
- 2025Security and Quality in LLM-Generated Code: A Multi-Language, Multi-Model Analysis3 Feb 2025
- 2024Reasoning Through Execution: Unifying Process and Outcome Rewards for Code Generation19 Dec 2024
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analytics18 Nov 2024