Open source with profanity in comments is statistically better than code without it


Code with swear words is better code

Jan Strehmel, student in the IT department from the Institute of Theoretical Computer Sciences (ITI) of the Karlsruhe Institute of Technology, Germany, he presented earlier this month a thesis degree with a very particular conclusion.

And is that according to his studies "Source code with profanity in comments is superior to source code without it."

The study revives a long-standing debate dividing the computing community. Some suggest that this practice is an indicator of the developer's state or environment, but others believe that these are harmless words that express 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 your study, reviewed and analyzed over 3800 open source code containing profanity in English and over 7600 profanity-free open source code on GitHub.

Next, Strehmel and his team quantified the compliance of these two different sets of open source code with coding standards. The results were presented as an indicator of the quality of the source code through the SoftWipe tool. The study relied solely on the 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 results," the team notes. In this sense, some experts say that swearing is a sign of creativity. According to them, swearing seems to be centered in 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 long before," said Emma Byrne, author of the book "Using Is 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 the report study of Strehmel, the use of such language in source code comments may be a sign of a negative attitude or stress among developers. developers. In other words, they believe that code quality has nothing to do with profanity and that these expressions they only allow a programmer to release his stress or any feelings towards your work. Basically, critics claim 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.


The content of the article adheres to our principles of editorial ethics. To report an error click here.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.