Abstract
Abstract
Context
Insufficient code understandability makes software difficult to inspect and maintain and is a primary cause of software development cost. Several source code measures may be used to identify difficult-to-understand code, including well-known ones such as Lines of Code and McCabe’s Cyclomatic Complexity, and novel ones, such as Cognitive Complexity.
Objective
We investigate whether and to what extent source code measures, individually or together, are correlated with code understandability.
Method
We carried out an empirical study with students who were asked to carry out realistic maintenance tasks on methods from real-life Open Source Software projects. We collected several data items, including the time needed to correctly complete the maintenance tasks, which we used to quantify method understandability. We investigated the presence of correlations between the collected code measures and code understandability by using several Machine Learning techniques.
Results
We obtained models of code understandability using one or two code measures. However, the obtained models are not very accurate, the average prediction error being around 30%.
Conclusions
Based on our empirical study, it does not appear possible to build an understandability model based on structural code measures alone. Specifically, even the newly introduced Cognitive Complexity measure does not seem able to fulfill the promise of providing substantial improvements over existing measures, at least as far as code understandability prediction is concerned. It seems that, to obtain models of code understandability of acceptable accuracy, process measures should be used, possibly together with new source code measures that are better related to code understandability.
Funder
Università degli Studi dell’Insubria
Publisher
Springer Science and Business Media LLC
Reference51 articles.
1. GitHub (2022) - json-iterator/java: jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go. https://github.com/json-iterator. Accessed 29 Sept 2023
2. GitHub - stleary/JSON-java (2022) A reference implementation of a JSON package in Java. https://github.com/stleary/json-java. Accessed 29 Sept 2023
3. SourceMeter (2022). https://www.sourcemeter.com/. Accessed 29 Sept 2023
4. Ajami S, Woodbridge Y, Feitelson DG (2019) Syntax, predicates, idioms - what really affects code complexity. Empir Softw Eng 24(1):287–328. https://doi.org/10.1007/s10664-018-9628-3
5. Arcuri A, Briand L (2014) A hitchhiker’s guide to statistical tests for assessing randomized algorithms in software engineering. Softw Test Verif Reliab 24(3):219–250
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A Dataset of Atoms of Confusion in the Android Open Source Project;Proceedings of the 21st International Conference on Mining Software Repositories;2024-04-15
2. TerraMetrics: An Open Source Tool for Infrastructure-as-Code (IaC) Quality Metrics in Terraform;Proceedings of the 32nd IEEE/ACM International Conference on Program Comprehension;2024-04-15