ESEIW 2024
Sun 20 - Fri 25 October 2024 Barcelona, Spain

Background: Code confusion concerns source code characteristics that make code harder for authors and reviewers to comprehend. Atoms of Confusion (AoC) are a set of low-level programming idioms for C-like languages that have been proposed as a potential source of code confusion; previous studies have empirically evaluated the extent to which they (i) are confusing to developers and (ii) introduce risk to software products.

Aims: In this study, we further explore Atoms of Confusion and question the assumptions associating them with defects, and associating their removal with defect-fixing activities.

Method: We mine 76,610 pull requests from six Java open-source projects, extracting and analyzing changes relating to AoC.

Results: First, we find no relation between the existence of AoCs and defect-fixing activity. Second, we observe that for some types of AoC—such as infix operator precedence and conditional operator—although quantitative analysis suggests a relation between their removal and fixes for defects, removing them does not contribute to the defect-fixing process. Finally, we find that project- and language-specific factors can affect the prevalence of AoC types, such as pre-increment/decrement and type conversion AoC.

Conclusion: While prior work reported that AoC impact defect proneness in systems written in C and C++, we find that the presence of AoC did not affect defect proneness in open-source Java projects. Our results suggest that future work is needed to investigate project- and language-specific factors such as project style guide and implicit type conversion that may impact the defect proneness of AoC.