this post was submitted on 07 May 2024
624 points (97.6% liked)

Programmer Humor

19486 readers
180 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 50 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 5 months ago (1 children)

I present to you quality variable names. (and a Mount Rustmore)

(Reconfigure(f), 'c') => {
    let mut p: Vec<&str> = vec![];
    loop {
        match args.next() {
            Some(k) => {
                if k == "=" {
                    match args.next() {
                        None => q("need value for Rc"),
                        Some(v) => u(
                            f,
                            |f| Box::new(
                                |c| {
                                    f(c);
                                    c.set(p.iter().copied(), v);
                                    for e in p {
                                        unsafe {
                                            Box::<str>::from_raw(
                                                std::mem::transmute(e)
                                            );
                                        }
                                    }
                                }
                            )
                        )
                    };
                    break
                } else {
                    p.push(Box::leak(k.into()));
                }
            }
            None => error("need path element or = for Rc"),
        }
    }
},
[–] [email protected] 1 points 5 months ago (1 children)
[–] [email protected] 2 points 5 months ago

Argument parsing; turning Rc foo = bar into Reconfigure(|c| c.foo = "bar").

[–] [email protected] 3 points 6 months ago (1 children)

Ok, but what variable is 🐈?

[–] [email protected] 2 points 6 months ago

Is the function to con🐈eate and print.

[–] [email protected] 3 points 6 months ago (1 children)

It took me too long to figure out the I in an if statement was just integer

[–] [email protected] 2 points 6 months ago

In a for statement, it often refers to index

[–] [email protected] 8 points 6 months ago (1 children)
[–] [email protected] 5 points 6 months ago

Gasboss gatelit girlkeep

[–] [email protected] 1 points 6 months ago

How dare you.... <Eye squint>

[–] [email protected] 15 points 6 months ago (3 children)

mathematician here, where is the joke?

[–] [email protected] 8 points 6 months ago (1 children)

in the linux community it's really common to have applications like MPD, music player daemon, or MPC, music player client, and ncmpc, ncurses music player client, and ncmpcpp the aforementioned one with ++ tacked onto the end.

Cmus, which from what i can recall is literally "c music player"

etc....

[–] [email protected] 1 points 5 months ago (1 children)

fia? fir? fib (part of fia)?

[–] [email protected] 2 points 5 months ago

exercise left up to the developer!

[–] [email protected] 23 points 6 months ago (2 children)

Variable names should be "self defining" meaning you should be able to understand what its doing from the name. The name also shouldn't be too long. Combining those together makes it difficult to come up with an "elegant" name

[–] [email protected] 5 points 6 months ago

tmp3 = tmp1 + tmp2 ; T.T

[–] [email protected] 15 points 6 months ago (1 children)

I think they got the joke, they were just joking about how this is common in math :P

[–] [email protected] 5 points 6 months ago

The most atrocious variable names I ever encountered in code were as a research assistant for a math professor doing game theory simulations. Literally unreadable unless you had a copy of his paper on the subject to refer to

[–] [email protected] 7 points 6 months ago (1 children)

This joke is funny only if placed in Arnold-Atyah manifold if Kolmogorov-Ramachandran-Yu metric is defined

[–] [email protected] 4 points 6 months ago* (last edited 6 months ago)

So don't use it in non-KRY-definite AA situations, or you could get erroneous results. QQX is fine though, as long as you have non-vanishing ABCD. /s

I wonder if Lean proofs become the new peer review like I've heard suggested, if mathematics might break from this, and look more compsci-ish in the future. That way non-specialists could get up to speed quickly.

[–] [email protected] 9 points 6 months ago (1 children)

Now I want to become a programmer so I can give variables people names.

[–] [email protected] 6 points 6 months ago

Ha

You should hear of the method of pretending you're at breakfast or some other anthropomorphized situation, where you name things as butter and cheese, knife and bread, tea and teapot

Then there's Hungarian notation which is actually used seriously. But I can't give an entertaining example only s boring and probably inaccurate one.

[–] [email protected] 21 points 6 months ago

Why is no one giving credit to my friend n?!

[–] [email protected] 17 points 6 months ago (1 children)
[–] [email protected] 5 points 6 months ago (1 children)
[–] [email protected] 4 points 6 months ago

You need to use trigger warnings for this kind of shit.

[–] [email protected] 20 points 6 months ago (1 children)

name your function as malloc() and see to world burn and generate bugs at factorial rate.

[–] [email protected] 4 points 6 months ago

If you name it malloc it will be easy to notice. On the other hand if you call it free....

[–] [email protected] 8 points 6 months ago* (last edited 6 months ago)

No, that's math.

load more comments
view more: next ›