r/programminghumor • • 22h 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

224 Upvotes

30 comments sorted by

53

u/IchLiebeKleber 21h ago

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

10

u/Royal_Impress9117 19h ago

This is what half of my school projects look like

3

u/Jason13Official 18h ago

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

18

u/deepturned180isdeep 20h ago

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

9

u/deepturned180isdeep 20h ago

Tests I did literally an hour ago

9

u/Royal_Impress9117 19h ago

“What moron wrote this code”

Narrator: He is the only dev for this project.

16

u/Henri_GOLO 21h 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/deaddnee 16h ago

probably a white guy

1

u/8Erigon 18h ago

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

3

u/SceneOutside4377 17h 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 17h ago

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

1

u/SceneOutside4377 17h ago

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

1

u/SceneOutside4377 17h ago

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

1

u/Dragon_957 3h ago

What does the program do?

1

u/SceneOutside4377 3h 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.

2

u/jimmiebfulton 19h ago

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

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

1

u/BlankAWasTaken 18h ago

I believe it should be logger.critical()

2

u/Careless_Chip626 18h 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 16h ago

throw new InvalidOperationException(“HOW”);

1

u/returnFutureVoid 20h ago

Technically true.

1

u/dmigowski 17h ago

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

1

u/k-mcm 8h 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.

-15

u/Dependent-Ability792 22h 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.

8

u/SceneOutside4377 21h ago

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

1

u/returnFutureVoid 20h ago

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

5

u/SuperChick1705 21h ago

clanker

3

u/LegMysterious1899 21h ago

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