Sweary source code comments a sign of competence

Originally published at: Sweary source code comments a sign of competence | Boing Boing

6 Likes

I frequently append texture names with swear words and other things, does that count?

9 Likes

I’m pretty sure it does. I love this correlation.

9 Likes

I once wrote a MIME encoder for a personal project and then needed one for work so I just took my personal one and added it to our repo. MIME parts are separated by a pre-defined string - it can be anything but it needs to be sufficiently unique that it could NEVER appear in the actual bodies of your parts. Mine was not exactly profanity but included some odd words and some profane words.

A while later a PM came to me and said “can you explain why this error message has… these words… in it” and I instantly recognized my MIME separator. I said “hm no but I’ll look into it!” and silently changed the separator string.

20 Likes

Don’t code quality tools, like SonarQube force you to remove comments in code in order for it to pass the build?

1 Like

If so, then it’s enforcing anti-quality. Comments in code are notes to future me as to what the hell was I thinking and why this ugly thing is ugly.

No comments is madness. A computer will run anything. Humans need context to fix/change/modify/refactor safely.

21 Likes

No, SonarQube does not require you to remove comments. It will sometimes inspect them for common things to look into, such as FIXME or TODO comments

6 Likes

I’m making sweary code comments, right now!

Unfortunately, they’re about someone else’s code.

Who would bother publishing a Fastapi+Vue project example with basic errors like component names that aren’t multi-word? And the depreciation/end-of-life warning messages installing Vue are a perfect example of the XKCD comic of how the Internet rests on small, poorly-maintained blocks of code.

10 Likes

Well, this was a sign of competence, but now that this is out, people will inevitably confuse causation with correlation and start giving people advice to swear more in their comments to improve the code quality. Someone will probably even make an IDE plug-in that uses ChatGPT to automatically make your comments “more sweary”.

8 Likes

I can’t get away with profanity at work, never know who is going to look at my code and have no sense of humor.

Still, I have gotten rather colorful with comments. That raised a few eyebrows when stuff I’ve written was being reviewed in preparation for being published in a journal or tech library. I think the biggest “WTF?” I’ve gotten from a tech reviewer was a rather generic request server. We didn’t know exactly what it would be used for, so I made the comments at the top of the module a Mad-Lib.

When invoked we ____________ the ___________ ( via an API call instead of __________ing it in its own ___________________ )
                   [verb]          [object]                                 [method]                     [private member]
 
     to _______________________  a given ______________  file.  The _______________________ goes into a ___________________
          [unpleasant action]              [data type]                 [icky substance]                   [storage device]
 
        that the _______________________ will use to repeatedly ________________________ the user
                   [random process]                                 [act of violence]
 
      until the ____________________ breaks off in their _________________________ and they have to go see a _______________________.
                [oddly shaped bit]                       [uncomfortable place]                               [medical specialist]
13 Likes

I recall back in the old days we were told to comment the hell out your code. Recently we have been told that good code should not need comments.

2 Likes

May be a configurable thing. We are forced to remove comments for the build to pass.

2 Likes

Given the examples used in section 2.1.3.1 of the thesis, could this plug-in be named CarlinGPT?

I too don’t use profanity in my test code, but I do have some whimsical data sets. Need three names? Huey, Dewey, and Louie appear in a number of places. I’m pretty sure if you search you’d find the names of the Beatles in code I’ve written as well, and I know for a fact I’ve used the Seven Dwarves.

4 Likes

That idea is such a terrible example of letting the means become the ends too. Yeah, the simplest things can be made easy enough to understand without comments. That doesn’t mean more complex things are somehow better explained through function names than actual explanations.

It seems to me like it also goes with the idea that any programmer should be able to maintain code without having to learn anything about what the program is for, which is an MBA fantasy about replaceable workers rather than anything sensible to aspire to.

17 Likes

i still regret the sweary comments of a refactor i did on my very first job, not even realizing that the person who wrote the original code was sitting right across from me

to be fair, i was young; and the code, terrible. i swear ( well i did ) someone was getting paid per line

i thought the same thing. the confusing part though was this:

stress generally decreases quality, so it’s interesting that quality was associated with times when people were stressed out enough to swear

4 Likes

Exactly this. When a system has passed through multiple hands and years, comments like would prefer to use a Null value here as the default, but it breaks the frobulator module. Instead, using blank string as default, which is nulled by a special case in the storage code

Comments are more for “what were they/I thinking.” If comments simply describe the code (sets default to blank string) then you have helped nobody.

11 Likes

even though i no longer swear in my comments, my internal voice is screaming. because you just know that comment was written on a one line inline function that’s called ‘set_default_to_blank()’ :cat2:

4 Likes

" If comments simply describe the code (sets default to blank string ) then you have helped nobody."

That’s true

1 Like

I actually don’t care one way or the other and can see arguments on both “sides”. But my guess is that “they” would say if your code is that complex, it should be refactored.

I usually curse while coding, especially if I’m tweaking someone else’s code. “Who the fuck would this think this was a good subroutine”, “wow, this code is shit”, “worst fucking callback ever”, etc. :smiling_imp:

3 Likes