Code with swear words is better code
Jan Strehmel, a student in the computer science department of the Institute for Theoretical Computing (ITI) at the Karlsruhe Institute of Technology in Germany, presented a bachelor's thesis earlier this month with a very particular conclusion.
And according to their studies , "source code with bad words in the comments is superior to source code without them."
The study revives a long-standing debate that divides the computer science community . Some suggest that this practice is an indicator of the developer's status or environment, while others believe these are harmless words expressing a developer's satisfaction with their creativity.
Much of the community considers profanity as a vulgar display of lack of intelligence and education, because why use profanity when you have a rich vocabulary? But some experts say the benefits are many.
"The benefits of swearing have only emerged in the last two decades, as a result of a lot of research on the brain and emotions, as well as much better technology for studying brain anatomy," said Timothy Jay, emeritus professor of psychology. at the University of Massachusetts. College of Liberal Arts, in the United States.
Jan Strehmel recently analyzed the impact of profanity on the quality of code produced by developers who use profanity in their comments.
As part of his study, he reviewed and analyzed more than 3800 open source code files that contained English swear words and more than 7600 open source code files that did not contain swear words on GitHub.
Next, Strehmel and his team quantified the conformity of these two distinct sets of open-source code to coding standards. The results were presented as an indicator of source code quality using the SoftWipe tool. The study was based solely on source code written in C.
“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.
“This leads to the next problem: although we have a statistically significant difference between the groups, it could be due to other underlying factors. It is important to note that small values do not guarantee that the results are reproducible or that statistical significance implies practical significance. This means that swearing will not automatically improve the quality of your code. However, a study has shown that swearing in the workplace can reduce stress, which could improve concentration and therefore code quality,” the study report explains.
“This could be a possible explanation for the study’s results,” the team notes. In this regard, some experts say that swearing is a sign of creativity. According to them, swearing seems to be centered on the right side of the brain, the part that scientists often call the “creative brain.” “We know that right-sided stroke patients tend to become less emotional, less able to understand and tell jokes, and tend to stop swearing, even if they used to swear a lot before,” said Emma Byrne, author of the book “Using It’s Good for You . ”
In 2018, Adam Farley, a contributor to the OpenJDK project, the presence of profanity in the source code. The most common profanities were bitc* and f*ck. According to him, there are at least 12 expressions of this type in the open source library and the list can be expanded if we delve into the dictionaries dedicated to software testing phases. Other observations in recent years have also shown that commit messages in open source projects can sometimes contain profanity.
However, according to reviews of Strehmel's report, the use of swearing in source code comments can be a sign of negative attitudes or stress among developers . In other words, they believe that code quality has nothing to do with profanity and that these expressions simply allow a programmer to release stress or other negative feelings about their work. Essentially, critics argue that the relationship between swearing and code quality is complex and not well-established. They also add that the study by Strehmel and his team is not representative.
Source: https://www.jwz.org/