Prevalence of confusing code in software projects: Atoms of confusion in the wild

Dan Gopstein, Hongwei Henry Zhou, Phyllis Frankl, Justin Cappos

    Research output: Chapter in Book/Report/Conference proceedingConference contribution

    Abstract

    Prior work has shown that extremely small code patterns, such as the conditional operator and implicit type conversion, can cause considerable misunderstanding in programmers. Until now, the real world impact of these patterns - known as 'atoms of confusion' - was only speculative. This work uses a corpus of 14 of the most popular and influential open source C and C++ projects to measure the prevalence and significance of these small confusing patterns. Our results show that the 15 known types of confusing micro patterns occur millions of times in programs like the Linux kernel and GCC, appearing on average once every 23 lines. We show there is a strong correlation between these confusing patterns and bug-fix commits as well as a tendency for confusing patterns to be commented. We also explore patterns at the project level showing the rate of security vulnerabilities is higher in projects with more atoms. Finally, we examine real code examples containing these atoms, including ones that were used to find and fix bugs in our corpus. In total this work demonstrates that beyond simple misunderstanding in the lab setting, atoms of confusion are both prevalent - occurring often in real projects, and meaningful - being removed by bug-fix commits at an elevated rate.

    Original languageEnglish (US)
    Title of host publicationProceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018
    PublisherIEEE Computer Society
    Pages281-291
    Number of pages11
    ISBN (Print)9781450357166
    DOIs
    StatePublished - May 28 2018
    Event15th ACM/IEEE International Conference on Mining Software Repositories, MSR 2018, co-located with the 40th International Conference on Software Engineering, ICSE 2018 - Gothenburg, Sweden
    Duration: May 28 2018May 29 2018

    Publication series

    NameProceedings - International Conference on Software Engineering
    ISSN (Print)0270-5257

    Other

    Other15th ACM/IEEE International Conference on Mining Software Repositories, MSR 2018, co-located with the 40th International Conference on Software Engineering, ICSE 2018
    Country/TerritorySweden
    CityGothenburg
    Period5/28/185/29/18

    Keywords

    • program understanding
    • programming languages

    ASJC Scopus subject areas

    • Software

    Fingerprint

    Dive into the research topics of 'Prevalence of confusing code in software projects: Atoms of confusion in the wild'. Together they form a unique fingerprint.

    Cite this