this post was submitted on 25 Sep 2024
396 points (97.4% liked)

Programmer Humor

19274 readers
2428 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 24 comments
sorted by: hot top controversial new old
[–] UpperBroccoli@lemmy.blahaj.zone 67 points 2 days ago (1 children)

STOP DOING C++

  • Templates were not supposed to make your error messages explode into unrecognizable gibberish
  • "Yes, please generate 5000 pages of garbage instead of an understandable error message!" - statements dreamed up by the utterly deranged

Look at what compilers have been demanding your respect for all this time:

???

They have played us for absolute fools.

[–] Buttons@programming.dev 40 points 2 days ago (1 children)

If you can't understand that error message then I don't know what to tell you.

[–] MonkderVierte@lemmy.ml 11 points 2 days ago (2 children)

Where in that wall of text was it?

[–] Buttons@programming.dev 17 points 2 days ago* (last edited 2 days ago)

I don't know. That's what I was saying. I can't possibly imagine what I could say to help someone understand that error message.

😉

[–] ulterno@lemmy.kde.social 3 points 1 day ago

The wall of text was the error message.

I just prefer using the parsed outputs from IDEs which also take you to the line of code on click.

[–] heavy@sh.itjust.works 6 points 2 days ago

Java when you don't put in a try catch, vs Template in Cpp

[–] qaz@lemmy.world 53 points 2 days ago (2 children)

This would have been better with Rust and C++

[–] anti_antidote@lemmy.zip 18 points 2 days ago (1 children)

I had a linker error in Rust for the first time today and I started crying til I saw someone say to just delete the build cache lol

[–] qaz@lemmy.world 13 points 2 days ago

With Rust it's usually just a fluke that can be fixed by doing that, but C++ linker errors may indicate the start of several frustrating hours. That's been my experience at least.

[–] Hominine@lemmy.world 29 points 2 days ago (1 children)

cries into the chest of the borrow checker

[–] repungnant_canary@lemmy.world 1 points 1 day ago (1 children)

Okay, but genuinely in what cases the borrow checker caused issues for you? Cause I use Rust for a few years now and have not yet encountered the infamous fight with the borrow checker.

Also, there's a "new" and "better" borrow checker coming in 2024 edition.

[–] Hominine@lemmy.world 4 points 1 day ago* (last edited 1 day ago)

'tis but a joke. I'm still learning Rust, and really appreciate the borrow checker.

[–] MonkderVierte@lemmy.ml 44 points 2 days ago
[–] lnxtx@feddit.nl 28 points 2 days ago (3 children)

Java:
NullPointerException

[–] loutr@sh.itjust.works 25 points 2 days ago (2 children)

Since Java 14 it looks like this:

Exception in thread "main" java.lang.NullPointerException:

Cannot invoke "String.toLowerCase()" because the return value of "com.baeldung.java14.npe.HelpfulNullPointerException$PersonalDetails.getEmailAddress()" is null

at com.baeldung.java14.npe.HelpfulNullPointerException.main(HelpfulNullPointerException.java:10)

[–] Buttons@programming.dev 8 points 2 days ago* (last edited 2 days ago) (1 children)

I haven't written any Java since Java 6. This makes me so happy to hear.

What about XML, and XML based configs? Is the Java ecosystem still obsessed with XML?

I remember I was once trying to learn Hibernate. After finding what I thought looked like the best tutorial, I skimmed through it and there was literally no Java code in the tutorial about a Java library! It was all XML! I never could understand it, but this was early in my career, maybe I could handle it now, maybe not.

[–] loutr@sh.itjust.works 8 points 1 day ago

Nah, Hibernate, Spring and most major Java frameworks have largely moved away from XML. It's still supported, but these days it's mostly configured in the code directly, with properties loaded from yaml, JSON or the environment (for containers).

The JDK ecosystem is in a pretty good spot nowadays. With Spring boot you can whip up a productions ready back-end very fast, or if you prefer a more hands-on approach there are lighter frameworks/libraries quarkus or micronaut.

The Java language itself has evolved fast and is actually pretty nice now, and if you prefer something more modern akin to TS or swift you can just use Kotlin which is almost 100% interoperable with Java.

[–] Kissaki@programming.dev 12 points 2 days ago

Formatted, so I can read it

Exception in thread "main" java.lang.NullPointerException: 
 Cannot invoke "String.toLowerCase()" because the return value of 
"com.baeldung.java14.npe.HelpfulNullPointerException$PersonalDetails.getEmailAddress()" is null
 at com.baeldung.java14.npe.HelpfulNullPointerException.main(HelpfulNullPointerException.java:10)
[–] Traister101@lemmy.today 19 points 2 days ago (2 children)

And the entire stack trace

[–] Generous1146@beehaw.org 6 points 2 days ago

And a description saying which variable in which object was accessed. Could be better, could be worse 🤷

[–] AVincentInSpace@pawb.social 1 points 17 hours ago

with the most recent call last, but the actual exception at the top

[–] fibojoly@sh.itjust.works 4 points 1 day ago

Holy shit in so glad it's not just me. All I have ever seen from Java seems to be NullPointerException. (Which makes sense, but still, it's pretty funny)

[–] SlopppyEngineer@lemmy.world 21 points 2 days ago

fatal error: Too many errors emitted, stopping now

[–] Starbuncle@lemmy.ca 7 points 1 day ago

Program exited with code -1