this post was submitted on 20 May 2026
1294 points (99.9% liked)

Programmer Humor

31506 readers
1924 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] rockSlayer@lemmy.blahaj.zone 227 points 22 hours ago (8 children)

god, this code is awful. Who wrote this?

git blame

Oh

[–] Feathercrown@lemmy.world 67 points 19 hours ago (3 children)

I love that they called it "blame" lol. They knew what it would be used for.

[–] affenlehrer@feddit.org 20 points 19 hours ago

Not sure if was there from the beginning but it was originally developed by Linus Torvalds and he can be quite harsh to the Linux contributors.

[–] myotheraccount@lemmy.world 19 points 19 hours ago

Subversion tried to call it "annotate", but that didn't stick ;)

[–] ati@piefed.social 4 points 19 hours ago

Isn't it alias for git praise?

[–] hdsrob@lemmy.world 107 points 21 hours ago (2 children)

Been writing the same software for 20+ years now, don't even need git blame to figure out what asshole wrote this shit.

[–] SystemDisc@lemmy.dbzer0.com 17 points 19 hours ago

Why is it always me? Haha

[–] Feathercrown@lemmy.world 8 points 19 hours ago

Yup there are certain patterns that I can just tell

[–] NotSteve_@lemmy.ca 26 points 19 hours ago (1 children)

That exact chain of events happened to me at my last job and I audibly laughed realising it was my own code. To my own credit though, it was a file I had written four years prior which at that point was more than half my whole career in the past

[–] some_designer_dude@lemmy.world 26 points 19 hours ago

If you aren’t ashamed of your work a year ago, you’re stagnating!

[–] jubilationtcornpone@sh.itjust.works 6 points 16 hours ago (1 children)

Past me was a moron sometimes.

[–] InternetCitizen2@lemmy.world 9 points 15 hours ago

Still am. But I used to too

Sometimes you don't even recognize your own trash, 6 weeks later.

[–] dan@upvote.au 12 points 19 hours ago

These days I see so much AI slop that my reaction when I see code I hand-wrote myself is "hey, that's pretty good".

My team's code is great, but we use a lot of shared code written by other teams, with varying levels of quality.

[–] Hettyc_Tracyn@lemmy.zip 8 points 20 hours ago (2 children)

I mean, admitting you have a problem is the first step to a solution…

[–] marcos@lemmy.world 8 points 20 hours ago (1 children)

Oh, man. Can you tell what the second step is? I'd really like to learn that.

[–] Hettyc_Tracyn@lemmy.zip 7 points 20 hours ago

Working to fix it… (which of course varies wildly based on the problem!)

[–] MonkderVierte@lemmy.zip 2 points 20 hours ago* (last edited 19 hours ago)

Not if the author was your boss.

[–] JATothrim_v2@programming.dev 5 points 20 hours ago* (last edited 17 hours ago) (1 children)

I have lately jokingly guessed when I see the particular style and confusion: it's you isn't it? And so far I have been right. The particular author's magic has expired, and I see the same fault replicated everywhere he has been.

[–] Feathercrown@lemmy.world 9 points 19 hours ago (2 children)

One of my coworkers is fond of using ternary expressions instead of "if" blocks. Even ones without an "else". So I see things like:

condition ? someVar = "blah" : null;

or

condition ? doSomething() : null

Which should both just use "if" statements. Or my favorite:

condition ? someVar = "foo" : someVar = "bar"

which should really be

someVar = condition ? "foo" : "bar"

[–] testaccount789@sh.itjust.works 4 points 18 hours ago* (last edited 18 hours ago) (2 children)

UUUuuuuuh, I am not a programmer (you're going to say "thank god"), but...

I sometimes even chain them. You can put yet another ternary operator in the else and keep going. You know, else-if.
So anyway, I can get ternary operators spanning 2 - 3 lines.
Oh, I also often have issues thinking of proper loops, so you'd see a few terribly used goto statements.

Although I do remove ones that are obvious brain fart.
For example, quite obvious

void example(bool true_or_false){
    if(true_or_false){
        //code if true
    }
    else{
        //code if false
    }
    //other code
}

Well, I've already had my brain goof up even that once or twice. "How the fuck", you're asking?

void example(bool true_or_false){
    if(true_or_false){
        goto if_true;
    }
    //code if false
    goto end_false_if;
if_true:
    //code if true
end_false_if:
    //other code
}

The brain-fart if-else.

[–] lukstru@piefed.social 2 points 9 hours ago (1 children)

You need another goto end right before the end_false_if:, otherwise the false code will always run

[–] testaccount789@sh.itjust.works 2 points 4 hours ago (1 children)

I tested it, it works as it is.

#include <stdio.h>
#include <stdbool.h>

void main(){
        bool true_or_false = true;
        if(true_or_false){
                goto if_true;
        }
        printf("This code runs only if false.\n");
        goto end_false_if;
if_true:
        printf("This code runs only if true.\n");
end_false_if:
        printf("This code always runs.\n");
}

If true, it jumps to if_true, then runs other code. If false, the if gets skipped, if false code gets run, then it skips over if true code.

[–] lukstru@piefed.social 2 points 3 hours ago

I totally did the thing where I commented without reading properly before. Sorry!

[–] Feathercrown@lemmy.world 8 points 16 hours ago

Dear lord lmao

[–] dbx12@programming.dev 5 points 19 hours ago (1 children)

The last thing, that would be a "request changes" for me.

[–] Feathercrown@lemmy.world 3 points 19 hours ago

I haven't seen him do it lately in any code I've reviewed but I do change it whenever I see it if I'm doing work nearby lol