Live data from Hacker News

Open source code with profanity in comments is statistically better

blog.desdelinux.net

31–40 of 221 posts

Re: Open source code with profanity in comments is statistically better

#32
post #18

Possible explanation: swearing is more likely to be committed into code by people who either (1) own the code, or (2) know they're too valuable to be punished. So it self-selects. I personally have very different commenting styles between my work and personal projects. Not that any of it's good.

Imo, it's because swearing indicates frustration, and frustration indicates effort.

Re: Open source code with profanity in comments is statistically better

#33
post #13

Earlier quoted context omitted.

I would bet the opposite because I can make a blind assertion.

You're beting that people swear in code in order to impress future employers?

No, they are saying your argument is baseless and they can do the same.

Re: Open source code with profanity in comments is statistically better

#34
Or that those that need to adhere to strict linters, formatting, etc are less happy with their life and thus use more profanity. eg. "code quality" tools that does not have any benefits besides finding potential bugs that does not effect the state of the program, like lines that are 71 characters long instead of 70 characters.

Re: Open source code with profanity in comments is statistically better

#35

I skimmed the paper, and it looks like they are looking for swearing _anywhere_ in the repos' code, not just comments. I would be curious to see the ratio of swearing in comments vs code identifiers. I'd also be curious to see if the repos with swearing in their comments just have more comments in total. Perhaps the correlation is, "code with more comments is more likely to be higher quality".

Swearing in the comments is for goodie goodies. Bad assed programmers swear in public apis like class names, functions, variables, and documentation!

Re: Open source code with profanity in comments is statistically better

#36
post #18

Possible explanation: swearing is more likely to be committed into code by people who either (1) own the code, or (2) know they're too valuable to be punished. So it self-selects. I personally have very different commenting styles between my work and personal projects. Not that any of it's good.

Alternative explanation in the same vane as your theory:

The cognitive and time cost of compliance for language policing takes away from valuable programming and planning involved in developing solutions. (i.e. "banned words" [swear words] and politicalized words [whitelist/blacklist,etc])

Antoher possibility is the people who don't want to deal with that are gone and we're seeing a loss of their contributions.

Re: Open source code with profanity in comments is statistically better

#37
From the research paper:

> we calculate the swear factor as the number of swearwords divided by the lines of code

That's what I suspected. Assuming that most swear words will be contained in comments, what this is actually measuring is the ratio of comments to code. In other words, code that is more heavily commented is better.

I think we already knew this.

That said I would like to see a more critical analysis. First control for comment density. Then compare code quality to swearing in comments and also variable names.

Re: Open source code with profanity in comments is statistically better

#38
My pet theory is that this is because honest, emotional comments are much more useful than the usual “professional” style that try to hide it when you have no clue what you’re doing.

When it’s clear someone was stuck, frustrated, banging their head against the wall etc while writing a particular bit of code, you can refactor a lot less defensively because you know the crappy parts weren’t secretly there for a reason.

I love real, honest, emotional comments. Pour all the frustration in there. Future you and your colleagues will thank you.

Re: Open source code with profanity in comments is statistically better

#40
post #5

I'd bet a lot of the non-profanity code is people open sourcing code just to be impressive on resumes or for school, where the profanity code is probably real code. Sounds likely to be a classic case of correlation != causation

Rorschach test for programmers: give your confident gut feeling explanation for this phenomenon. I'll do mine: there's likely a correlation between needing to maintain a professional conduct which includes forgoing foul language (you're programming at work) and writing code under time pressure where getting a product ready for release is more important than strict adherence to clean programming practice (you're progr…

My gut feeling: when you start to submit swear words in your code, it indicates that you "breathe" the code and know it in and out.

The other extreme: if you have no idea what you are doing, you might try to mimic "corp speak" in your code to hide the fact that you actually have no clue.

In other words: it needs some confidence in your ability to assess some aspect of the code in order to use swear words.

Post reply on HN