Do the best coders swear more, or does C just do that to the good programmers? – Ars Technica

A person shouting at his computer.

Have you ever found yourself looking at a tricky coding problem and thinking “shit”?

If these thoughts find their way into your code or related comments, you’re in good company. When undergraduate student Jan Strehmel of the Karlsruhe Institute of Technology analyzed open source code written in the C programming language, there was no shortage of obscenity. While one might expect it, Strehmel’s overall conclusion may not be that the average quality of code containing profanity was significantly higher than the average quality of code that did not.

“The results are quite surprising! said Strehmel. Programmers and scientists may have a lot of follow-up questions. Are the researchers sure that some profanity-prone programmers aren’t skewing the results? What about other programming languages? And, more importantly, why would swearing correlate with high-quality code? The work is in progress, but even without all the answers, one thing is certain: Strehmel has just written one hell of a bachelor’s thesis.

Big words, good code

Strehmel’s supervisor, bioinformatician Alexandros Stamatakis, began to wonder how swear words affect code quality after a member of the lab showed him a graph of the prevalence of swear words in various versions of the code underlying Linux. . Stamatakis realized he had the perfect tool to ask if profanity correlated with code quality. A program called SoftWipe, developed by his lab, measures adherence to coding standards, such as the use of quality checks and a simple code structure.

To investigate, Strehmel pulled about 3,800 code samples that contained swear words, as well as 7,600 code samples that did not, from GitHub. SoftWipe found that, on average, code containing swear words scored about half a point higher on its 10-point code quality scale than code that didn’t. “My reaction was that it’s cool!” said Stamatakis. He frequently finds himself swearing at his own code, though he tends not to document his outbursts in text. Nevertheless, he wonders if his past curses can help him progress in his career: “Maybe it helped me to become a full professor!” he said.

Psychologists have long known that swearing can relieve pain, increase physical performance, and help people shape their personalities. In fact, cognitive psychologist Benjamin Bergen of the University of California, San Diego, author of the book, What is the F: what swearing reveals about our language, our brain and ourselves— makes it a point to swear once in every college lecture he teaches (in a way that won’t offend the class) because profanity, when used strategically, is proven to can increase student engagement.

But the link between swear words and code quality has never been examined before, as far as Bergen knows, and the suggestion that there is a link is a “very exciting and interesting idea”, he said. he declares.

The power of personality

Programmers who swear may be more emotionally involved in their work than those who don’t, Bergen hypothesized, which could lead them to produce higher quality products. Alternatively, programmers may include profanity to amuse or shock people reading their code – and if they expect their code to be read, they may put extra effort into it. It’s likely that swearing is a “symptom of something deeper,” Bergen said, and he’d like to see future work focus on the underlying cause of the association.

Software engineer Greg Wilson, who now works for biotech company Deep Genomics, isn’t surprised to see coders’ personalities come into their work through their word choices. Wilson co-founded an organization called The Carpentries that teaches scientists to be good coders and says, “I don’t know of anyone who’s good at anything outside of that.”

Wilson is excited to see researchers tackle the question of what makes code good, though Strehmel’s findings are preliminary. Coders lag behind other disciplines in terms of evaluating their own work, he says. Unlike architects, who have nuanced ways of describing why a building is beautiful, programmers “can say something is an elegant solution, and then we run out of words.”

However, he worries about the impacts profanity can have if it seems aimed at junior programmers. Aggressive language has been cited as a factor that discourages people, especially those from marginalized groups in STEM, from continuing to work in software engineering. Strehmel and Stamatakis encountered occasional insults in the code they analyzed, and they agree that there are lines that programmers shouldn’t cross. At some point, “it stops being funny,” Stamatakis said.

Overall, however, the researchers appreciate their work and they have a long list of experiments planned to back up the results and glean additional insights. When they’re ready to release their final product, Wilson looks forward to seeing the pledge message. He imagines her reading “Holy shit, it worked!”

Saima Sidik is a freelance science writer based in Somerville, Massachusetts. When she’s not writing, she enjoys cycling around town, learning photography and practicing taekwondo.

Leave a Comment