r/programminghumor • • 6d ago

Was looking through one of my old Java programs and forgot I did this

Post image

Typing random shit for unused cases has to be a top 3 programming habit of mine

386 Upvotes

41 comments sorted by

81

u/IchLiebeKleber 6d ago

Exception up = new Exception("something went really wrong");
throw up;

18

u/Royal_Impress9117 6d ago

This is what half of my school projects look like

2

u/meinkr0phtR2 4d ago

I put this in one of my school assignments as a joke.

3

u/Jason13Official 5d ago

Oh this made me chuckle, might use it for more laughs

28

u/deepturned180isdeep 6d ago

Ah the mark of a true engineer, baking self-deprecating logic or test cases right into the code

14

u/deepturned180isdeep 6d ago

Tests I did literally an hour ago

4

u/git_push_origin_prod 5d ago

At least I know your commit messages are human. At this point, I’ll accept “wip”, “shit”, “fuck” and “more” as acceptable git messages for humans. squash and merge that PR baby, fuck the CI tests

2

u/deepturned180isdeep 4d ago

git -c sequence.editor="sed -i.bak '2,\$s/^pick /squash /'" -c core.editor=true rebase -i --root

What commits?

12

u/Royal_Impress9117 6d ago

“What moron wrote this code”

Narrator: He is the only dev for this project.

20

u/Henri_GOLO 6d ago

I had a classmate who submitted homework with a slur when an exception is caught.

Let's just say the teacher was not happy... At least I knew that wasn't targeted toward him.

1

u/git_push_origin_prod 5d ago

What was the slur? In what context?

2

u/Henri_GOLO 4d ago

When checking for an array length, if different than some value it throws an exception with just "connard" (asshole)

1

u/git_push_origin_prod 4d ago

Not that bad, but yea, gotta be professional

-2

u/deaddnee 5d ago

probably a white guy

7

u/k-mcm 5d ago

I once threw a RuntimeException titled "<my boss's name> sucks" because his code never handled edge cases correctly. Once day it was thrown, never caught, and a customer called support to ask what it meant.

5

u/jimmiebfulton 6d ago

Dude... it's clear you're not Enterprising this sufficiently:

logger.debug("haha u such noob");

2

u/BlankAWasTaken 6d ago

I believe it should be logger.critical()

1

u/8Erigon 5d ago

Maybe it's common knowlegde for Java devs but what is "getSystemLookAndFeelClassName" or "setLookAndFeel"?

3

u/SceneOutside4377 5d ago

If I remember correctly (and I may not because I've been doing a lot more C++  and Python than Java recently), in Java Swing, which is the package I was using to make a GUI for this program, the default window style looks boring as hell so what that does is set the window style to whatever your system default is. In my case Windows. Not too sure how it works because I googled it, but I just couldn't look at that ugly ass default window anymore

2

u/8Erigon 5d ago

... could have just called it setDesign() ...
How tf named these?!

1

u/Juff-Ma 1d ago

But it isn't the Design. Have to defend Java here. It also affects how the app interacts.

The methods are verbose but you really appreciate that sometimes. You just know what it does by looking at it. I prefer this over needles abbreviations that nobody will understand.

1

u/SceneOutside4377 5d ago

For example, here's what the GUI looks like for a silly test program I made a year ago

2

u/SceneOutside4377 5d ago

And here's the GUI after setting the look and feel to the system default:

1

u/Dragon_957 5d ago

What does the program do?

2

u/SceneOutside4377 5d ago

It's a program I made my senior year of high school that finds all the words in a Boggle grid. I had found a random website with a daily Boggle puzzle and got bored of playing it the intended way very quickly, so I took it as a challenge to see how long it would take me to cheese it. It uses recursive DFS to scan all the possible letter combinations on the grid, and then checks each of those combinations against a Trie to see if they are valid words. The pictured code is just some startup code that sets up the GUI and generates the Trie based on what's in the "wordlist.txt" file.

1

u/IntelligentWall7345 4d ago

Was this declared in an interface? public is grayed out.

1

u/SceneOutside4377 4d ago

Apparently, you don't need to declare the main method as public anymore, even without an interface. I think that's stupid; I was raised on public static void main(String[] args) and I'll be damned if anyone's going to make it easier for me.

3

u/Careless_Chip626 6d ago

I have clauses in all of my imports for if I run them instead of importing them that just says You stupid

2

u/GamerNumba100 5d ago

throw new InvalidOperationException(“HOW”);

2

u/IndomitableSloth2437 17h ago

I have one that said something like "OH GOD SOMETHING WENT HORRIBLY WRONG"

1

u/returnFutureVoid 6d ago

Technically true.

1

u/dmigowski 5d ago

Why the fuck does nobody note that dude swallowed the exception? That's a deadly sin in my company

1

u/Ok_Brain_2376 4d ago

lmao, this reminds me when GTA 5 codebase got leaked, alot of comments were added similar to this

-15

u/Dependent-Ability792 6d ago

the highlighted one is a catch block that prints "make a quick nap" lol. honestly that's the most honest thing in the whole file.

9

u/SceneOutside4377 6d ago

Aww, a brand new bot just for me! I feel so special

1

u/returnFutureVoid 6d ago

Why does this exist? It’s just wrong and stupid.

5

u/SuperChick1705 6d ago

clanker

4

u/LegMysterious1899 6d ago

i guess i'm retiring from my job being a reddit commenter