Affiliation:
1. Faculty of Information Technology Beijing University of Technology Beijing China
2. School of Software Engineering South China University of Technology Guangzhou China
Abstract
AbstractContextCode readability is one of the most important quality attributes for software source code. To investigate which features affect code readability, most existing studies rely on correlation‐based methods. However, spurious correlations (a mathematical relationship wherein two variables appear to be causal but are not) involved in correlation‐based methods may affect research conclusions.ObjectiveIn order to remove spurious correlations and obtain conclusions from the perspective of causation as to what makes a readable code, we propose a causal theory‐based approach to analyze the relationship between code features and code readability scores.MethodFirst, we adopt the PC algorithm and additive noise models to construct the causal graph on the basis of the selected code features. Then, we use the linear regression algorithm based on the back‐door criterion to obtain the causal effect of different features on code readability.ResultWe conduct a set of experiments on readability data labeled by human annotators. The experimental results show that the average number of comments positively impacts code readability, with each additional unit increasing the code readability score by 0.799 points. Whereas the average number of assignments, identifiers, and periods have a negative impact, with each additional unit decreasing the code readability score by 0.528, 0.281, and 0.170 points respectively.ConclusionWe believe that our findings will provide developers with a better understanding of the patterns behind code readability, and guide developers to optimize their code as the ultimate goal.
Funder
National Key Research and Development Program of China
National Research Foundation of Korea
Natural Science Foundation of Beijing Municipality
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Replication of a Study about the Impact of Method Chaining and Comments on Readability and Comprehension;2024 4th International Conference on Code Quality (ICCQ);2024-06-22
2. Source Code Summarization & Comment Generation with NLP : A New Index Proposal;2024 International Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA);2024-05-23