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.
Year
DOI
Venue
2018
10.1145/3196398.3196432
MSR
Keywords
Field
DocType
Programming Languages, Program Understanding
Data mining,Confusion,Programming language,Computer science,Software bug,Conditional operator,Software,Semantics,Linux kernel
Conference
Volume
ISSN
ISBN
2
2160-1852
978-1-4503-5716-6
Citations 
PageRank 
References 
2
0.36
17
Authors
4
Name
Order
Citations
PageRank
Dan Gopstein181.85
Hongwei Henry Zhou220.36
Phyllis G. Frankl372354.98
Justin Cappos4174.48