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

    Other

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

    Fingerprint

    Atoms
    Linux

    Keywords

    • program understanding
    • programming languages

    ASJC Scopus subject areas

    • Software

    Cite this

    Gopstein, D., Zhou, H. H., Frankl, P., & Cappos, J. (2018). Prevalence of confusing code in software projects: Atoms of confusion in the wild. In Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018 (pp. 281-291). IEEE Computer Society. https://doi.org/10.1145/3196398.3196432

    Prevalence of confusing code in software projects : Atoms of confusion in the wild. / Gopstein, Dan; Zhou, Hongwei Henry; Frankl, Phyllis; Cappos, Justin.

    Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018. IEEE Computer Society, 2018. p. 281-291.

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

    Gopstein, D, Zhou, HH, Frankl, P & Cappos, J 2018, Prevalence of confusing code in software projects: Atoms of confusion in the wild. in Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018. IEEE Computer Society, pp. 281-291, 15th ACM/IEEE International Conference on Mining Software Repositories, MSR 2018, co-located with the 40th International Conference on Software Engineering, ICSE 2018, Gothenburg, Sweden, 5/28/18. https://doi.org/10.1145/3196398.3196432
    Gopstein D, Zhou HH, Frankl P, Cappos J. Prevalence of confusing code in software projects: Atoms of confusion in the wild. In Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018. IEEE Computer Society. 2018. p. 281-291 https://doi.org/10.1145/3196398.3196432
    Gopstein, Dan ; Zhou, Hongwei Henry ; Frankl, Phyllis ; Cappos, Justin. / Prevalence of confusing code in software projects : Atoms of confusion in the wild. Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018. IEEE Computer Society, 2018. pp. 281-291
    @inproceedings{bb35088a1e3f4806895f9eda8ed67d76,
    title = "Prevalence of confusing code in software projects: Atoms of confusion in the wild",
    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.",
    keywords = "program understanding, programming languages",
    author = "Dan Gopstein and Zhou, {Hongwei Henry} and Phyllis Frankl and Justin Cappos",
    year = "2018",
    month = "5",
    day = "28",
    doi = "10.1145/3196398.3196432",
    language = "English (US)",
    isbn = "9781450357166",
    pages = "281--291",
    booktitle = "Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018",
    publisher = "IEEE Computer Society",

    }

    TY - GEN

    T1 - Prevalence of confusing code in software projects

    T2 - Atoms of confusion in the wild

    AU - Gopstein, Dan

    AU - Zhou, Hongwei Henry

    AU - Frankl, Phyllis

    AU - Cappos, Justin

    PY - 2018/5/28

    Y1 - 2018/5/28

    N2 - 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.

    AB - 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.

    KW - program understanding

    KW - programming languages

    UR - http://www.scopus.com/inward/record.url?scp=85051661014&partnerID=8YFLogxK

    UR - http://www.scopus.com/inward/citedby.url?scp=85051661014&partnerID=8YFLogxK

    U2 - 10.1145/3196398.3196432

    DO - 10.1145/3196398.3196432

    M3 - Conference contribution

    AN - SCOPUS:85051661014

    SN - 9781450357166

    SP - 281

    EP - 291

    BT - Proceedings - 2018 ACM/IEEE 15th International Conference on Mining Software Repositories, MSR 2018

    PB - IEEE Computer Society

    ER -