this post was submitted on 06 Jul 2024
845 points (100.0% liked)

Programmer Humor

418 readers
3 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
top 46 comments
sorted by: hot top controversial new old
[–] Honytawk@lemmy.zip 132 points 2 months ago (3 children)

Same with BIOS descriptions.

FGTSAB switch [toggles the FGTSAB setting]

infuriating

[–] Andromxda@lemmy.dbzer0.com 24 points 2 months ago
[–] Artyom@lemm.ee 22 points 2 months ago

It's so bad it's almost artistic

[–] Amir@lemmy.ml 3 points 2 months ago

Love having to enable "support for sleep state 5" to turn off USB power when the PC is off

[–] yetAnotherUser@discuss.tchncs.de 69 points 2 months ago (4 children)
/*
 * Gets stupidFuckingInteger
 *
 * @returns stupidFuckingInteger
*/
public double getStupidFuckingInteger() {
    return stupidFuckingInteger;
}

[–] mrpants@midwest.social 22 points 2 months ago* (last edited 2 months ago) (1 children)

The lack of a return type declaration makes this sooo good.

[–] expr@programming.dev 21 points 2 months ago* (last edited 2 months ago) (1 children)

It has the return type declared to be double.

[–] mrpants@midwest.social 12 points 2 months ago

I cannot read. Even better.

[–] Amir@lemmy.ml 13 points 2 months ago

This being a double physically hurts

[–] ILikeBoobies@lemmy.ca 10 points 2 months ago

Makes sense, people looking for int would find a double

[–] AdNecrias@lemmy.pt 3 points 2 months ago (1 children)

Reminds me of a job I had where c# summaries were mandatory and people used a documentation generator just like that.

/// Ages the Category. public int AgeCategory (...)

[–] schnurrito@discuss.tchncs.de 3 points 2 months ago

plenty of APIs in Java have documentation like that and it is worst when I read the documentation in order to find out the definition of the nouns and verbs used there and then it is just like that

[–] cupcakezealot@lemmy.blahaj.zone 45 points 2 months ago* (last edited 2 months ago) (1 children)

//@TODO document this function later

15 years later

[–] Shoe@lemm.ee 4 points 2 months ago

Have reviewed 16 year old code for a very well known company in the last week with this exact comment peppered throughout, alongside delightfully helpful comments like:

// do not delete or change this it just works

// TODO temporary fix added 12/09/11 to fix incident must be removed ASAP

// CAUTION this returns false here instead of true like it normally does, not sure why

// if true then matched to valid account not is true

[–] mundane@feddit.nu 41 points 2 months ago (3 children)

Comments should explain "why", the code already explains "what".

[–] smeg@feddit.uk 38 points 2 months ago* (last edited 2 months ago) (3 children)

The allowable exception is when the what is a what the fuck, as in you had to use a hack so horrible that it requires an apology comment

[–] mundane@feddit.nu 8 points 2 months ago

Absolutely, although I see that as part of why

Why is there a horrible hack here? Because stupid reason...

[–] sukhmel@programming.dev 4 points 2 months ago

Or if the what is so cryptic and esoteric that it would require the reader a couple hours of research to understand it.

Also, I find it useful to summarise the what before code blocks if that can't be summarised in a function name

[–] bleistift2@sopuli.xyz 3 points 2 months ago

Describing the what also helps when you dabble in a new technology or little-used technology. It helps to explain to yourself what you’re doing and it helps in onboarding. “Hey, newbie, there’s a function in XYZ module that’s extensively documented. Look there for guidance.”

[–] azdle@news.idlestate.org 3 points 2 months ago (1 children)

Unless you're working with people who are too smart, then sometimes the code only explains the how. Why did the log processor have thousands of lines about Hilbert Curves? I never could figure it out even after talking with the person that wrote it.

[–] mundane@feddit.nu 1 points 2 months ago* (last edited 2 months ago)

If you know how the code does something, you also know what it does.

load more comments (1 replies)
[–] Johanno@feddit.org 30 points 2 months ago (1 children)

I write such comments because I have to.

Company policy.

Also we have to specify every line of code and what it should do.......

[–] ulterno@lemmy.kde.social 5 points 2 months ago (1 children)

I feel like I am going to have to do the same thing in the end, to get my hand-over accepted.
Should I just copy the line of code and make a comment next to it with:

// It does 

CC BY-NC-SA 4.0

[–] VOwOxel@discuss.tchncs.de 7 points 2 months ago (1 children)

Do you license every comment of yours? If yes, why? Tbh i'm just curious

[–] ulterno@lemmy.kde.social 8 points 2 months ago (2 children)

Not every. The quick, very-low effort ones, I just leave.

Why:
I saw another post with "Anti Commercial AI License", then wen on to read the license and went, "Neat!".

  • It makes it easier for anyone to decide what to do if they want to use my comment/post (in cases where it actually has something useful)
  • It makes life just a bit harder for people data-mining for AI
    • That way, some data entry worker will probably ask for a raise and probably even get it and maybe some entrepreneur going "AI everywhere!" will think twice.
    • Or there will be a chatbot spouting "Anti Commercial AI License" or "CC By-NC-SA" in their answer text, which would be hilarious.

CC BY-NC-SA 4.0

[–] communism@lemmy.ml 5 points 2 months ago (1 children)

How are you inserting your signature? is it manually? Do you have some kind of keyboard shortcut to insert it?

[–] ulterno@lemmy.kde.social 5 points 2 months ago* (last edited 2 months ago)

For now, I have just saved it in my clipboard application, so I copy-paste.
When it goes out of history, I just open a file, where I have saved it and copy from there. So it's pretty crude.

I was hoping that either the KDE Social web interface would add a "Signature" feature or I would pick some Lemmy application that would allow that, but for now it's just this.

Perhaps, if I feel like it's being too frequent, I may set a compose key for it.

CC BY-NC-SA 4.0

[–] AlexanderESmith@social.alexanderesmith.com 4 points 2 months ago (1 children)

It's cute that you think data miners give a fuck about the license of anything they scrape.

[–] ulterno@lemmy.kde.social 0 points 2 months ago

It's unfortunate that despite explaining as properly as I could, my point was misinterpreted as me relying upon someone caring about licenses.

CC BY-NC-SA 4.0

[–] snaggen@programming.dev 10 points 2 months ago (1 children)
[–] Fargeol@lemmy.ml 5 points 2 months ago

answer: the answer

[–] bricklove@midwest.social 7 points 2 months ago (1 children)

I got a media failed to load error at first and thought that was the joke

[–] ArchRecord@lemm.ee 2 points 2 months ago

Both jokes can be true 😅

[–] navi@lemmy.tespia.org 5 points 2 months ago (1 children)

A real comment in our junior year game engine codebase.

[–] tiredofsametab@kbin.run 2 points 2 months ago
[–] fnmain@programming.dev 3 points 2 months ago

Fs.?g??yy V>

At work we let Typescript and descriptive naming document our code. Only when something is a workaround or otherwise weird will we add comments. So far it has worked great for us.

[–] isVeryLoud@lemmy.ca 3 points 2 months ago (2 children)
[–] Andromxda@lemmy.dbzer0.com 3 points 2 months ago

I don't know. Anyway, DankPods is awesome, there's a great Lemmy community dedicated to his channel: !dingusland@suppo.fi

[–] Venator@lemmy.nz 1 points 2 months ago
[–] zerofk@lemm.ee 2 points 2 months ago* (last edited 2 months ago)

Our code base is filled with “//constructor”, “//destructor”, “//assignment”, or the ever enlightening “Foo GetFoo(); // GetFoo”.

This is not what they mean by self-documenting code.

[–] KillingTimeItself@lemmy.dbzer0.com 2 points 2 months ago* (last edited 2 months ago) (1 children)

this is why i very rarely comment with descriptive comments. If you're reading my code and don't understand what it is, even with how shit it is, you have no business reading whatever fucking crackpot shit im writing.

[–] potustheplant@feddit.nl 4 points 2 months ago (1 children)

You must be fun to work with.

[–] KillingTimeItself@lemmy.dbzer0.com 1 points 2 months ago (1 children)

you say this like im the type of person to write code with other people.

[–] potustheplant@feddit.nl 3 points 2 months ago (1 children)

Doesn't matter. Even if it's your code, you might revisit something you made months or a year after doing it and having comments will speed up your work. It's a very basic good practice.

i do have comments, for some things, but there are a lot of "commenting" standards that are just shit. I find i don't care what the actual piece of code is doing, i care more about it's place in the rest of the code, and i'd much rather have "anti comments" instead.