this post was submitted on 15 Jul 2023
1216 points (98.9% liked)

Programmer Humor

19512 readers
385 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 21 points 1 year ago (3 children)

Jfc. Do people really write code like this? I’ve been writing code in Java for 15+ years and have never seen anything like this.

You need more skill, not a wider monitor. SMH.

[–] [email protected] 18 points 1 year ago (2 children)

Hello world in Java:

class 9-A {
    public static endangered therefore protected final void main(String[] args) {
        System.prepareTheOutputBufferForPrintingAsTheNextStatementWillDoSo(args);
        System.in.out.in.out.shake.it.all.around("Java is a programming language " +
            "invented by the intelligent monkeys " +
            "working at Sun Microsystems.");
        return void; // duh!
    }
 }
[–] [email protected] 6 points 1 year ago (1 children)

ROFL you’ve proved my point. Just because Java gives you an opportunity to hang yourself doesn’t mean you should or have to.

You took one line of code and turned it into a novel. Bad programmers do this and then ignorant folks blame it on the language when it’s really just a lack of knowledge/skill.

[–] [email protected] 1 points 1 year ago

You must be fun at parties! Seriously, this is a meme sub and the wildly exaggerated helloworld example I pasted (from this hilarious article) is obviously satire. I agree, that

  1. There are way worse programming languages than Java
  2. The verbosity is not the biggest problem of java, it is rather the dogmatic OOP paradigm that sucks.
[–] [email protected] 3 points 1 year ago

I get making fun of java's verbosity for things like checked exceptions but hello world really isn't that much worse than most other languages especially considering all the "boilerplate" is required for any program more complicated than hello world in pretty much every language. But if a useless program really is too verbose for you see java 21.

void main() {
  System.out.println("hello world");
}
[–] [email protected] 11 points 1 year ago* (last edited 1 year ago) (1 children)

Yeah, you never see this in enterprise settings. Sure builders or streams can get a bit long but you just pop each .x() on a new line.

And when they're on new lines intellij has a cool feature where it creates a little UI only comment next to the line showing what type it returns.

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

In an enterprise setting we'd definitely create a method in that object what would have that chain in it, and call that instead... It seems like it's used over, and over again.

Anyhow, we're sitting here trying to make sense of something that obviously some sort of joke haha.

Man we're such fucking nerds.

[–] [email protected] 4 points 1 year ago

Somewhere someone probably does... But this piece of code really look like someone either tried to inline a bunch of calls or this is code generated object mapper from json or other nested model.

Nobody with a sane mind and serious attitude will use this code as a "real" code. (I still believe in people, despite all the evidence to the contrary I get every day)

As a fun bit though this taken some dedication.