Live data from Hacker News

Open source code with profanity in comments is statistically better

blog.desdelinux.net

181–190 of 221 posts

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

#181
post #104

Earlier quoted context omitted.

In which situation would you not have access to the repo? I guess if it's a library or something, but libraries must always be documented in a different way to business code.

Maybe you're a contractor. Maybe it's legacy code that has simply been archived. Maybe the network is down. Maybe there was a bad migration. Sidecars generally suck because they get lost.

If that's the case, you have bigger problems than documentation

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

#182

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. Firs…

Isn’t commented code no longer considered a good idea in most companies? I used to work for a bank and the policy is no comments unless absolutely necessary, because comments become out of date. Doxygen is the only real comments allowed.

If you're curious to read a well-earned take on comments: http://antirez.com/news/124.

Inline comments are a reflection on the authors' abilities to write good comments. They can be kinda useless, actually-bad, or really helpful.

One canonical example of a "good comment" is explaining why a strange or not-the-least-complex approach was taken to implementing a certain solution. The code is like chesterton's fence, and the comment is a post explaining why it's there. That way, future readers can better assess for themselves whether it's worth their time trying to tear down the fence.

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

#183

I find it a bit suspect swearing would ever even get though a proper code review. It’s extremely unprofessional, I would tell someone to remove it.

And this is precisely how language policing slows down technical progress.

No, this is why you should be a professional. Swearing doesn’t belong in your employers codebase, it’s tasteless, looks bad, and may age very, very poorly.

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

#184

I find it a bit suspect swearing would ever even get though a proper code review. It’s extremely unprofessional, I would tell someone to remove it.

you're from the east coast, aren't you?

I’m not from America at all.

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

#185
post #181

Earlier quoted context omitted.

Maybe you're a contractor. Maybe it's legacy code that has simply been archived. Maybe the network is down. Maybe there was a bad migration. Sidecars generally suck because they get lost.

If that's the case, you have bigger problems than documentation

Like what?

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

#186

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. Firs…

as long as we’re designing the ideal experiment for someone else to do, let’s throw in the commit messages as well. I wouldn’t be surprised if code quality goes up with comment curses and down again with commit message curses.

My favorite infamous example being the MPV C locale commit: https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...

You can really feel the author's rage at the state of the world.

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

#187

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. Firs…

>...code that is more heavily commented is better. >I think we already knew this

Who's "we"?

In my many years of software development, I've found a very large fraction of developers use very few, or even zero comments, and it's getting worse. Just look at the posts below here: there's a bunch of people arguing that comments are useless or harmful. It's no wonder that software sucks so much these days, since apparently no one believes in documentation or code maintenance any more.

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

#188
post #172

Earlier quoted context omitted.

No it doesn’t. If any more than 0% of comments contain profanity, then on average code with more profanity will be better.

Not quite.. You still have to assume that there is more profanity per comment than per (uncommented) LOC. A piece of code with a lot of swear words for variable names but no comments at all would be an extreme example.

>You still have to assume that there is more profanity per comment than per (uncommented) LOC.

I think that's a very safe assumption. People don't generally use profanity for actual code (variable or function names etc.).

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

#189
An alternative take:

Swearing was more abundant in the earlier days and the code that survived until today is probably better that what got lost along the way.

In general the coding population has grown, we're more used to coding in corporate settings with code reviews, commit message processing etc. and the bulk of devs aren't just as emotional in writing their comments (some will still swear like sailors, but it's not the norm)

> The study relied solely on the source code written in C.

This in particular, probably reduced the number of hobby and beginner's project in the study.

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

#190
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.

Or as Good to Great calls it, "Confronting the brutal facts".

"This is bullshit" is an important realization. If you can't say it, then things will stay miserable.

Post reply on HN