Code with swearing is better code.

Jan Strehmel:

We find that open source code containing swearwords exhibit significantly better code quality than those not containing swearwords under several statistical tests. We hypothesise that the use of swearwords constitutes an indicator of a profound emotional involvement of the programmer with the code and its inherent complexities, thus yielding better code based on a thorough, critical, and dialectic code analysis process.

Previously, previously, previously, previously.

Tags: ,

20 Responses:

  1. Ben says:
    7

    Could just be that swearing is a sign of fluency and creativity, which turns out to be useful in programming. https://edition.cnn.com/2021/01/26/health/swearing-benefits-wellness/index.html

  2. Adede says:
    12

    If only column sticking out of the "with swear words" histogram was a bit to the left, it would look like the graph was giving us the finger.

  3. MattF says:
    9

    There’s clearly a sub-population of coders whose work improves if they are allowed to let off steam.

  4. tfb says:
    9

    Looking at the right-hand 'with swearing' the obvious conclusion would be 'not enough data points'.  Maybe that's wrong but it is really suspiciously not like any kind of sane distribution, unlike the 'without swearing' graph.

  5. marinsteve says:
    6

    For laughs I grepped all the profanity in the Netscape Communicator source when it was about to be released. The code quality must have been high, because there was lots of shit like:

    /* Words cannot express how much HPUX SUCKS! */
    # define rename hpux_sucks_wet_farts_from_dead_pigeons
    /* I can't fucking believe the contortions we need to go through here!! */

    • Philip Guenther says:
      2

      I was once in a con-call with HPUX engineers where I described horrific (in violation of POSIX, God, and Man, etc) behavior of write-vs-mmap and asked about an undocumented ioctl (i.e., "summon eldritch entity") that we heard Netscape's IMAP server used to solve this.  It was hard to hear the HP engineers over the cries of the souls of the damned, but they seemed to say that they disabled that ioctl as soon as Netscape products stopped being a market driver.

      There were other sins, but that particular fuckery and the code I wrote to deal with it are not forgotten: may HPUX rot in the grave dug by vulgar code comments it provoked.

      • Tom Buskey says:
        1

        HP-UX is bad enough that Solaris has a bug fix for it.  IFF you used ZFS, timestamps have microseconfs.  HP-UX hits the server twice and balks if the timestamps don't match.  Which is against the NFS standard.  So Sun recommended NFS v2 instead of v3 or v4 for HP-UX clients.  Because it doesn't have those timestamps.

  6. prefetch says:
    7

    Alternative hypothesis: Code without swearing suffers quality degradation due to the suffocating corporate policies and procedures that prevent swearing from making it into the published code (and/or talented coders actively avoid places like that).

  7. Mike says:
    1

    In my opinion the reason for the above average code quality is, rather than emotional investment, that swear words indicate hard to find/diagnose/solve problems were discovered in the code and then solved (presumably the swear words would not be present in published commits if not).

    This of course assumes that most developers refrain from using foul language unless frustrated.

  8. thielges says:

    Cussing in comments.  How quaint.
    I'm sure many here are aware of the inclusive naming initiative which seeks to replace troublesome words used in coding with those that do not carry negative baggage.  If all goes to plan we won't be required to type murderous intent when we "cancel -9" a process.  Here is a fairly comprehensive list of forbidden words and their replacements.

    • Randy says:

      That's a little bit ridiculous to replace "kill a process" with "cancel a process". Processes do not get offended when you kill them. This article is talking about comments in the code itself though...

    • Jim says:
      1

      SAP's (and Stanford IT')s lists are tiny compared to Google's developer documentation style guide word list. Some of the entries are mindboggling. For instance, "with" is forbidden to express ownership or use.

      • Nick Lamb says:
        2

        Google's style guide is about making your meaning clear, which is a lot more than just inclusive language. Sometimes being clearer is also beneficial for inclusivity, for example when discussing the risks of Thalidomide with a patient it matters whether they can technically become pregnant, not whether they're a woman.

        But sometimes it isn't - as far as I know we aren't missing any minorities out by writing "the new product with a color screen" rather than "the new product which has a color screen" but we are clearer with the latter because we're avoiding an opportunity for confusion about, for example, whether the screen is part of the product or this is just a bundle.

        Consistency also matters, if we use language consistently then people are more confident they understood, so this can be an argument to avoid synonyms or near synonyms. It's amazing how many people don't realise "Use by" and "Best before" aren't the same thing, because they sound so similar but of course they're used differently. If some vendors wrote "Use by" when they meant "Best before" that would make this far worse.

        We expect style to matter in programming, for example in Rust style if I named the function as_bytes() it implies that while maybe to me they have some other meaning if you just want bytes that's fine too, it's "free" - whereas to_bytes() suggests a potentially expensive (slow? memory intensive?) operation for me to make those bytes you want out of whatever this is now. But this consistency can make sense in other fields where clarity is a priority too.

      • Nix says:
        2

        Following the usual rule for such prohibitionist documents (see also, Strunk and White), "with" is used to express ownership dozens of times in that document alone. I suspect the same is true of many other foundational parts of the language that the stupid thing sees fit to try (and inevitably fail) to prohibit.

    • James says:

      I can't tell if this is ironic or sincere...

    • Leonardo Herrera says:

      I come from a country with no racial issues (well, we do, but they seem minor to me, and its more an indigenous vs everybody else thing.) In Spanish we have some "blanco" and "negro" stuff but it looks (to me!) that they don't come from race but light and dark. Other countries have that too I imagine. So is "whitelist" a race thing? Or "blackhat" and "whitehat"? (Master-slave I can understand, but still looks silly to my race-unaware mind.)

  9. 1

    Yup, that makes total sense <3

  10. Jesse Jenkins says:

    Let's just assume it's Tourettes.

Leave a Reply

Your email address will not be published. But if you provide a fake email address, I will likely assume that you are a troll, and not publish your comment.

Starting a new top-level thread.

  • Previously