831
top 50 comments
sorted by: hot top controversial new old
[-] Sharlot@lemmy.world 1 points 1 hour ago

Ah yes, readable code… if you’re fluent in Ancient Developer.

[-] spirinolas@lemmy.world 3 points 3 hours ago

The moment when you realize you wrote it.

[-] magitian@programming.dev 0 points 4 hours ago* (last edited 4 hours ago)
[-] AntiBullyRanger@ani.social 7 points 10 hours ago* (last edited 10 hours ago)

𓎼𓏏 𓎼𓂧
spoiler gitgud
getgoodreach better[ment]

[-] theneverfox@pawb.social 15 points 13 hours ago

I get regularly complimented on my code for how understandable it is radiates smugness

[-] RonSijm@programming.dev 1 points 2 hours ago

It's ChatGPT that's commenting this, isn't it?

[-] umbrella@lemmy.ml 29 points 18 hours ago

who the fuck wrote this garbage

me. its just me every time.

[-] Klear@quokk.au 93 points 1 day ago
[-] ttyybb@lemmy.world 38 points 1 day ago

What idiot wrote this? It's complete nonsense... Oh right.

[-] bitjunkie@lemmy.world 1 points 1 hour ago

I forget which extension it is but the thing that shows a faint git blame at the end of the line under cursor in VS Code has been… humbling.

[-] Klear@quokk.au 38 points 1 day ago

Why the fuck would I do this? This is nonsense. This way is way better.

*half an hour later, when I run into a major, strangely familiar bug*

Ooooohhhh!

[-] Clent@lemmy.dbzer0.com 11 points 20 hours ago

That's when a "here be dragons" comment needs to be added.

load more comments (3 replies)
/*
By all accounts, the logic in this method shouldn't work. And yet it does. We do not know why. It makes no sense whatsoever. It took three weeks and numerous offerings to the programming gods, including using one of the junior devs as a human sacrifice, to unlock this knowledge. DO NOT LET HIS VIOLENT AND UNTIMELY DEATH BE IN VAIN! Touch this at your own peril.
--jubilationtcornpone 12/17/25
*/
public async Task<IResult> CalculateResultAsync()
{
     // Some ass backwards yet miraculously functional logic.
}
[-] pinball_wizard@lemmy.zip 3 points 10 hours ago

--jubilationtcornpone

He led the retreat that saved our town!

[-] ChickenLadyLovesLife@lemmy.world 7 points 14 hours ago

That long-ass horizontal scroll bar reminds me of how I used to put unfindable easter eggs into my Visual Basic apps. I would have amusing little messages pop up from time to time in message boxes. To prevent anyone from just searching for the exact text in the message box, I would reduce it to a series of concatenated Chr() statements and then I would put like 200 characters of whitespace in front of the message box call. The only way anybody would spot it would be if they noticed the horizontal scroll bar this produced and nobody ever did.

At least that's my theory. It's also possible that nobody ever used the software that I produced.

[-] Hudell@lemmy.dbzer0.com 2 points 10 hours ago

A friend of mine used to teach coding decades ago and one story I'll never forget is about the student who had an assignment that asked for a "for" loop to be used, but they didn't quite know how to use it so they just wrote a broken loop there and then hid a "while" loop at the far end of the line.

Code compiled, had a "for" loop and had the right output.

[-] ttyybb@lemmy.world 105 points 1 day ago

A skilled programmer can make self documenting code, so I always document mine.

[-] MotoAsh@piefed.social 17 points 22 hours ago* (last edited 22 hours ago)

Nah. No code actually documents itself. Ever. Anyone who says they can is an idiot that doesn't understand the purpose of comments and docs.

Code can never describe intent, context, or consequences unless you read every line of code in every library and framework used, and every external call. Especially if they aren't doing "fail fast" correctly.

[-] defaultusername@lemmy.dbzer0.com 14 points 19 hours ago
// Prints "Hello World!" to the screen
printf("Hello World!");
[-] MotoAsh@piefed.social 10 points 19 hours ago* (last edited 19 hours ago)

I did not say comments should directly explain what the code is obviously doing.

[-] ChickenLadyLovesLife@lemmy.world 11 points 14 hours ago* (last edited 14 hours ago)

My favorite thing about the "all comments are bad" crowd is that their first example is almost always something like this:

// Add 1 to x
x = x + 1

Like, nobody that thinks comments are good and important would ever add a useless comment like that. The point of commenting is to add documentation (usually the only form of documentation that a future developer is ever going to read) only to code that would otherwise be inscrutable.

[-] Hudell@lemmy.dbzer0.com 2 points 10 hours ago* (last edited 9 hours ago)

You'd think that, and yet I've once worked in a project in a fortune 500 company that basically wouldn't even compile if we didn't add comments like that. No kidding the compiler enforced specific comment patterns so if you had a line do x = x + 1, it would not compile if it was not preceded by a comment that started with "Add" and included "1" and "to x". Even in dev mode if you wanted to just try something you had to comment everything.

The original dev was super proud of this tools that generated HTML documentation about everything based on those comments. And the whole documentation was stuff like:

*price*: The price
[-] MotoAsh@piefed.social 2 points 8 hours ago

Every good idea can be taken to a ridiculous extreme.

and that... is ridiculous.

[-] SeductiveTortoise@piefed.social 26 points 1 day ago

I inherited a code base probably written by a squirrel, and the first thing I did was to write documentation on infrastructure, business logic, architecture, deployment and whatever. I had to read everything anyways, because the guy handing it over had no idea what it did and left the company shortly after. It's fine now, but that path was horrible.

[-] dejected_warp_core@lemmy.world 26 points 23 hours ago
[-] hakunawazo@lemmy.world 29 points 21 hours ago
[-] dejected_warp_core@lemmy.world 5 points 20 hours ago
[-] harmbugler@piefed.social 2 points 14 hours ago* (last edited 14 hours ago)

The main reason I put effort into comments

load more comments (2 replies)
[-] Someonelol@lemmy.dbzer0.com 17 points 21 hours ago

I'm living this right now. The lead programmers are long gone for a setup that uses Python, C++, and Linux. The only other guy who knows it is pulled to three other projects and I only have a C++ class taken over 15 years ago under my belt. I'm somehow expected to decipher this shit and explain the function of a few dozen variables and it's going as well as one might expect.

[-] Bronzebeard@lemmy.zip 26 points 23 hours ago

Who wrote this shit?!

Oh, it was me. Last month.

[-] RedFrank24@piefed.social 55 points 1 day ago

The only times I've seen devs do inline comments in their code is when it's been done by AI, and I can tell it's AI because the comments are all useless and describing what's happening, not why.

[-] Eiri@lemmy.ca 53 points 1 day ago
// Format user object
function formatUserObject(user) {

I've seen lots of such crap written by humans. I guess AI had to learn it from somewhere.

[-] Thorry@feddit.org 18 points 1 day ago

AI mostly learned it from programming tutorials and things like documentation and Q&A forums like StackOverflow. People often add comments in those cases to explain to somebody not familiar with code what is happening so they can learn from it.

In actual code written by people who write code for a living I'd hope the comments are much more useful and usually not as prevalent.

load more comments (5 replies)
[-] konalt@lemmy.world 29 points 1 day ago

// 🚨 Log error to console console.error(error);

[-] tauonite@lemmy.world 5 points 17 hours ago* (last edited 17 hours ago)

I once tried vibe coding a web app using GitHub Copilot. That motherfucker wrapped every single endpoint with

try:
    ...
except Exception:
    return "An error occurred"

What the fuck is wrong with you Copilot? This piece of shit trying to hide all the errors. If I don't know there are errors then there aren't errors. Apparently

[-] bitjunkie@lemmy.world 1 points 45 minutes ago

It's actually kind of hilarious how closely it mimics a human programmer who just sucks at it.

[-] ChickenLadyLovesLife@lemmy.world 3 points 14 hours ago* (last edited 14 hours ago)

I wish to god Visual Basic was still around so Copilot et. al. could get infected with ON ERROR RESUME NEXT statements. Or its under-appreciated but vastly more horrific cousin ON ERROR RESUME.

[-] pinball_wizard@lemmy.zip 2 points 10 hours ago* (last edited 10 hours ago)

I might make that my first coding project after I retire. I bet I can code up a global import that implements "ON ERROR RESUME" in a couple of modern languages...

[-] Thorry@feddit.org 24 points 1 day ago* (last edited 1 day ago)

// 🤦 You are totally right! Simply logging the 🚨 error to the console isn't proper error handling. 🫣 We now throw an exception instead. throw new ApplicationException(error);

load more comments (6 replies)
[-] HairyHarry@lemmy.world 39 points 1 day ago

Decoding hieroglyphs with an English dictionary should do the work.

load more comments (2 replies)
load more comments
view more: next ›
this post was submitted on 18 Dec 2025
831 points (98.5% liked)

Programmer Humor

27914 readers
2033 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 2 years ago
MODERATORS