Jan Strehmel, a student in the IT department at the Karlsruhe Institute of Technology’s Institute of Theoretical Computer Sciences (ITI), stated in his thesis that “source code with profanity in comments is superior to source code without it.”
Strehmel compared examples that used any of over 300 swear words to starred repositories in over 10,000 code repositories. Using the open-source software benchmarker Softwipe to score each repository, the researchers discovered that repositories that contain swear words have a higher concentration of code at the upper echelons of the softwipe scale.
Strehmel and his colleagues quantified the coding standards compliance of these two different sets of open-source code. The results of the SoftWipe tool were presented as an indicator of the quality of the source code. The study was entirely based on C source code. The paper hypothesizes that swearing “represents an indicator of a profound emotional involvement of the programmer,” which leads to better code via a more “thorough, critical, and dialectic code analysis process.”
“We found that open source that contains profanity exhibits significantly better code quality than open source that does not contain profanity, according to various statistical tests. We hypothesize that the use of profanity is an indicator of the programmer’s deep emotional involvement with the code and its inherent complexities, thus producing better code based on a thorough, critical, and dialectical code analysis process,” the study report says. However, the team insists that this study is an observational study, as it does not control for any group of developers.
Bergen hypothesized that programmers who swear are more emotionally engaged with their work than those who don’t, which could lead to higher-quality products. Alternatively, programmers may include profanity in their code to amuse or shock people who read it—and if they expect their code to be read, they may put extra effort into it.
According to cognitive psychologist Benjamin Bergen of the University of California San Diego, swearing is likely a “symptom of something deeper going on,” and he’d like to see future research focus on the underlying cause of the association.
The sources for this piece include an article in ArsTechnica.