Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Learning a Metric for Code Readability

Published: 01 July 2010 Publication History
  • Get Citation Alerts
  • Abstract

    In this paper, we explore the concept of code readability and investigate its relation to software quality. With data collected from 120 human annotators, we derive associations between a simple set of local code features and human notions of readability. Using those features, we construct an automated readability measure and show that it can be 80 percent effective and better than a human, on average, at predicting readability judgments. Furthermore, we show that this metric correlates strongly with three measures of software quality: code changes, automated defect reports, and defect log messages. We measure these correlations on over 2.2 million lines of code, as well as longitudinally, over many releases of selected projects. Finally, we discuss the implications of this study on programming language design and engineering practice. For example, our data suggest that comments, in and of themselves, are less important than simple blank lines to local judgments of readability.

    Cited By

    View all
    • (2024)DistilKaggle: A Distilled Dataset of Kaggle Jupyter NotebooksProceedings of the 21st International Conference on Mining Software Repositories10.1145/3643991.3644882(647-651)Online publication date: 15-Apr-2024
    • (2024)Method-level Bug Prediction: Problems and PromisesACM Transactions on Software Engineering and Methodology10.1145/364033133:4(1-31)Online publication date: 13-Jan-2024
    • (2024)JOG: Java JIT Peephole Optimizations and Tests from PatternsProceedings of the 2024 IEEE/ACM 46th International Conference on Software Engineering: Companion Proceedings10.1145/3639478.3640040(11-15)Online publication date: 14-Apr-2024
    • Show More Cited By

    Recommendations

    Reviews

    Ned Chapin

    Buse et al. had 120 subjects-mostly undergraduates majoring in computer science-rate the readability (not complexity) of 100 snippets of Java source code from five major open-source programs. Then, they statistically analyzed the resulting 12,000 ratings: "This analysis seems to confirm the widely held belief that humans agree significantly on what readable code looks like, but not to an overwhelming extent." This paper, a continuation of the authors' ongoing research work on this project, reports their results, which are drawn mostly from their correlation analyses. As a part of their project, the authors also produced an unnamed software metric that is based on and uses counts of 25 specific features of Java source code. This software metric is the focus of the paper. The authors report that their metric is somewhat better than their human subjects at assessing readability. According to metric runs on more than two million lines of Java open-source code, including some longitudinal studies, their metric "dramatically" correlated with code changes and bug reports for 15 major open-source programs. Furthermore, the paper states that their metric can be obtained quickly, in only a few minutes, which is far faster than the human response time. The paper's major points are summarized in three figures. Figure 9 shows that only three Java source code features increase readability; the two most powerful features are average comment frequency and average blank line ratio (the most powerful). Figure 12 shows the metric's flagging of source code defect potential, for 13 open-source Java programs. Figure 15 illustrates the metric's relationship to source code program maturity, for 12 open-source Java programs. The authors report positive results for their metric, which reflects favorably on their work. Hopefully, they will continue this project and publish additional reports. That being said, the paper suffers from trying to cover too much in too few pages. For example, the authors do not report the usual basic statistics for their metric, such as standard deviations and levels of statistical significance; instead, they prefer to use qualitative terms such as "dramatically." Although the authors acknowledge that statistical correlations are a poor fit for their data, they still use and report them. While principal component analysis is briefly mentioned, any specifics seem to be withheld for a future paper. The authors mention relative predictive power, but fail to defend or adequately explain its use. A statistician should have advised the authors on how to strengthen their analysis work and present the results in a more sharply focused manner; perhaps it was just a problem of balancing the paper's length and its content. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Comments

    Information & Contributors

    Information

    Published In

    cover image IEEE Transactions on Software Engineering
    IEEE Transactions on Software Engineering  Volume 36, Issue 4
    July 2010
    142 pages

    Publisher

    IEEE Press

    Publication History

    Published: 01 July 2010

    Author Tags

    1. FindBugs.
    2. Software readability
    3. Software readability, program understanding, machine learning, software maintenance, code metrics, FindBugs.
    4. code metrics
    5. machine learning
    6. program understanding
    7. software maintenance

    Qualifiers

    • Research-article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 10 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)DistilKaggle: A Distilled Dataset of Kaggle Jupyter NotebooksProceedings of the 21st International Conference on Mining Software Repositories10.1145/3643991.3644882(647-651)Online publication date: 15-Apr-2024
    • (2024)Method-level Bug Prediction: Problems and PromisesACM Transactions on Software Engineering and Methodology10.1145/364033133:4(1-31)Online publication date: 13-Jan-2024
    • (2024)JOG: Java JIT Peephole Optimizations and Tests from PatternsProceedings of the 2024 IEEE/ACM 46th International Conference on Software Engineering: Companion Proceedings10.1145/3639478.3640040(11-15)Online publication date: 14-Apr-2024
    • (2024)Towards Inclusive Source Code Readability Based on the Preferences of Programmers with Visual ImpairmentsProceedings of the CHI Conference on Human Factors in Computing Systems10.1145/3613904.3642512(1-18)Online publication date: 11-May-2024
    • (2024)Properties and Styles of Software Technology TutorialsIEEE Transactions on Software Engineering10.1109/TSE.2023.333256850:2(159-172)Online publication date: 1-Feb-2024
    • (2024)Transformers in source code generationJournal of Systems Architecture: the EUROMICRO Journal10.1016/j.sysarc.2024.103193153:COnline publication date: 1-Aug-2024
    • (2024)On the effectiveness of developer features in code smell prioritizationJournal of Systems and Software10.1016/j.jss.2024.111968210:COnline publication date: 1-Apr-2024
    • (2024)An Empirical Study on Automated Test Generation Tools for Java: Effectiveness and ChallengesJournal of Computer Science and Technology10.1007/s11390-023-1935-539:3(715-736)Online publication date: 1-May-2024
    • (2024)How do annotations affect Java code readability?Empirical Software Engineering10.1007/s10664-024-10460-w29:3Online publication date: 3-May-2024
    • (2024)A verified low-level implementation and visualization of the adaptive exterior light and speed control systemInternational Journal on Software Tools for Technology Transfer (STTT)10.1007/s10009-024-00750-526:3(403-419)Online publication date: 1-Jun-2024
    • Show More Cited By

    View Options

    View options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media