Understanding a software system is a major activity during the maintenance and evolution of the system. Researchers studied how developers understand source code and which factors reduce program comprehension. They reported that shorter identifier names have a negative impact on program comprehension. The use of short identifiers is a symptom of a broader naming problem. Consequently, researchers introduced linguistic anti-patterns (LAs) to describe bad practices in the naming, documentation, and implementation of code entities, which can have a negative impact on program comprehension.
In this study, we make the hypothesis that LAs have a small impact on program comprehension because they can be easily recognised by developers. To test our hypothesis, we conducted an empirical study to investigate whether the occurrences of LAs do indeed affect code comprehension by asking participants to perform comprehension tasks on code containing or not occurrences of LAs, with and without prior knowledge of LAs. We also examined whether participants could recognize LAs by identifying them in various code snippets and assessed the ease of LA recognition with and without prior knowledge. We also evaluate the impact of knowledge of LA on program comprehension and LA recognition. We measured participants’ performance (1) in comprehension tasks using the correctness of their answers, time spent, and perceived effort and (2) in recognition tasks also using correctness. Our findings indicate that, while LAs do impact program comprehension, this impact is small or negligible because LAs are recognised by developers. They also show that learning about LAs can mitigate their negative impact by improving their recognition rates.
We thus conclude with the possible negative result that linguistic antipatterns may not actually function as antipatterns, given their minimal impact on program comprehension.