An Empirical Characterization of Developers' Perceptions on Code Readability
Authors/Creators
Description
Readability models have been proposed to measure the effort to read code, and ASAT tools are proposed to check code issues and recommend refactoring operations. However, developers could have different perceptions of what means readable code is because perception is highly individual. The consequence is these readability models have limitations to capture the quality improvements in code as perceived by developers. Even a recent readability model proposed to detect improvements on GitHub repositories also has 33\% of false positives, essentially because different perceptions could involve conflicting motivations, e.g., some developers could add comments aiming to improve readability, and other developers could remove comments for the same motivation. To address these limitations, this paper presents a study to characterize this gap between theory and practice, providing empirical evidence on how developers perceive code readability. We extracted 1988 Merged Pull Requests (PRs) on Github with readability improvement description, and produce a catalog with 35 different developer's motivations on 201 Java classes from 193 PRs that contain readability improvements described by the developers. Using these Java classes, we extracted two versions (before and after the readability improvement ) to measure the degree of coverage of each kind of developers' motivations considering state-of-art readability models, ASAT tools, and refactoring operations. We observe that the main developer motivations are related to reducing code verbosity using new language features, producing a more self-describing code in short methods (applying extract method refactoring). We also observed the state-of-art readability models, in general, have limitations on capturing the readability improvements applied by developers, but we find significant statistical differences in removing duplicate and boilerplate code developers' motivations. The RefactoringMiner and SonarQube tools did not find refactoring operations or issues in more than 90 Java classes with readability improvements, which suggests some kinds of readability improvements do not have correspondent refactoring operations or issues reported by ASAT tools. This result suggests a deeper investigation on large-scale developers' perceptions samples about readability improvements aiming to re-evaluate these characteristics in a more prevalent set of motivations.
Files
Chapter.zip
Files
(340.9 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:45f083dd09a1be3ed0ce7b4b8cf115ad
|
340.9 MB | Preview Download |