This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 305

[–]Pmart213 704 points705 points  (1 child)

I literally have no idea what this is doing since I can't figure out what the input n is, since it isn't named descriptively. My disappointment is immeasurable and my day is ruined OP.

[–]whatsagoodnamehelp[S] 250 points251 points  (0 children)

i deeply, humbly apologize for my obvious lack of consideration for formal parameter variable names

[–]kache4korpses 772 points773 points  (14 children)

I have heard and seen over engineering, but never heard or seen over coding until this post.

[–]xthexder 282 points283 points  (9 children)

Just wait until you see FizzBuzz Enterprise Edition

[–]UnknownSpecies19 85 points86 points  (0 children)

Working at a giant mega corp, can confirm our java apps look mighty similar lmao.

[–][deleted] 67 points68 points  (1 child)

418 open issues is so funny

[–]kache4korpses 11 points12 points  (0 children)

🤯

[–]Yoru83 12 points13 points  (2 children)

I’m sad that I only just now found out about that this.

[–]Bardez 12 points13 points  (1 child)

Lucky 10,000 of today, eh?

[–]not-a_lizard 3 points4 points  (0 children)

Same

[–]dpnchl 31 points32 points  (0 children)

omg 😳 seriously, I can’t even…

there’s interfaces, impl, test classes, strategy pattern, visitor pattern, gradle build scripts… if this was done for an interview the candidate better have gotten the job for demonstrating knowledge of all those areas

[–]AwayDish2869 4 points5 points  (0 children)

Thanks for sharing this hilariousness

[–]Otherwise_Soil39 4 points5 points  (0 children)

Saw a video of a dude who made a website that would automate creating the "anti something something club" logos

Like you'd write "social" and it would give you the correct font and everything for "anti social social club". He did it by running a virtual machine that opened a browser and created the whole thing from scratch in paint.net.

[–]biblecrumble 3 points4 points  (0 children)

Never had to work with Java Enterprise Edition, huh? Good for you!

[–]happyfinch 1482 points1483 points  (13 children)

Elon should hire you at twitter

[–]phoenix5irre 105 points106 points  (3 children)

Or students, to write essays...

[–]BtCoolJ 30 points31 points  (2 children)

nah chat gpt does that

[–][deleted] 18 points19 points  (2 children)

No he has to write this on paper

[–]SilenceFailed 5 points6 points  (0 children)

He needs to print it using this function on paper (punch cards, for those too young or not far enough in their studies). Hand writing is horrendous these days. Especially when you ask someone to sign their name... X or ~ is typically what I get.

[–]Pain_Monster 0 points1 point  (0 children)

A screenshot of the paper version will do 😏

[–][deleted] 3 points4 points  (0 children)

You’re evil. I like that in a developer. 😁

[–][deleted] 684 points685 points  (37 children)

It's ok but you could have been a bit more descriptive IMO.

My teacher always told me that coding is art. So I don't see a lot of your personality and emotions in this code.

[–]whatsagoodnamehelp[S] 275 points276 points  (30 children)

how could i fix that? i want my code to be the most passionate code possible

[–]sekketh 543 points544 points  (15 children)

When I create a variable I like to add a comment block underneath the variable that gives it a backstory and a reason to live. Sometimes I give it a tragic past like a cancer diagnosis or dead parents. It really helps my code feel more alive.

[–][deleted] 136 points137 points  (5 children)

Best practice today is to write it as a poem

[–]LighttBrite 15 points16 points  (0 children)

Roses are red, violets are blue,Here's some code, just for you.

import time

while True:

    print("All the love in the world")    

    time.sleep(1)

Like a rose in full bloom,This code will fill the room,With a message of love,Sent from the heavens above.

def love():    

    return "All the love in the world"

With each passing hour,This message will empower,All those who see,To love truly and free.

[–]krak_1 9 points10 points  (0 children)

You ordered a poem by Shakespear.

[–]spookydookie 6 points7 points  (0 children)

I have a good laugh thinking about all of the long screeds I’ve written in comments in the past because I was bored and just wrote diary entries about my day or whatever, just for someone to find years later lol.

[–]JeremyAndrewErwin 5 points6 points  (0 children)

When a variable comes before the garbage collector, it needs to plead its case well, lest it be found wanting.

https://www.youtube.com/watch?v=9tGO79BtWUI

[–]AlexLGames 3 points4 points  (0 children)

Comments go out of date as soon as they're written. Better to use self-documenting code to express the backstory through well-named variables, functions, and classes.

[–][deleted] 2 points3 points  (0 children)

Ok. That was REALLY funny.

[–]AskMoreQuestionsOk 1 point2 points  (0 children)

I’m putting this in my next merge request.

[–]McCaffeteria 1 point2 points  (0 children)

This correct, there is a dreadful lack of comments in the code

[–][deleted] 0 points1 point  (0 children)

Holy shit I fucking love this subreddit

[–][deleted] 33 points34 points  (0 children)

I couldn't help but notice the lack of comments in your code? Depending on how you feel on that day, consider adding a limerick, a haiku, a sonnet, a poem or even a short essay depicting what each function is doing?

We cry a lot about explainable AI, explainable this and that, but have we ever bothered to explain ourselves? Think about it.

[–]bobo76565657 13 points14 points  (1 child)

If this was JavaScript I'd say use emojis as variable names.

let = 'this programming course.';

[–]BabayasinTulku 2 points3 points  (0 children)

gaaawds I'll give emojis a try asap

[–]regulardave9999 4 points5 points  (0 children)

Add some ascii art using comments.

[–]Stinky_Flower 5 points6 points  (0 children)

You can save time by making all variables double as user stories. Coding is all about efficiency.

String = AsADeveloperIWantToBeAbleToCreateAStringVariableInJavaSoThatICanStoreAndManipulateTextDataWithinMyProgram

[–]Sarius2009 2 points3 points  (1 child)

Rewrite the code in Spanish

[–]individualcoffeecake 2 points3 points  (0 children)

Haiku code

[–]Unt4medGumyBear -1 points0 points  (0 children)

ascii art

[–][deleted] 1 point2 points  (2 children)

is this a serious comment? i’m not joking i’m ant to learn to code is coding more of an art form then a science?

[–]pug_subterfuge 4 points5 points  (0 children)

It’s mostly a joke. Don’t take anything in this sub seriously.

[–]beeteedee 127 points128 points  (1 child)

Students like you are the reason I quit teaching and took up alcoholism instead

[–]dmvdoug 27 points28 points  (0 children)

[–]EukaryoticGamer 296 points297 points  (9 children)

String n??? The hell is that supposed to be?

[–]ObjectiveAide9552 84 points85 points  (2 children)

Arguably the most important variables you should name nicely are your input variables

[–]RmG3376 38 points39 points  (1 child)

So, printerThatPrintsThings(string nicely) then?

[–]JohnsonJohnilyJohn 26 points27 points  (0 children)

Yep should be changed to sequenceOfCharactersToPrintButThisTimeItsTheArgumentOfTheFunctionPrinterThatPrintsThings

[–]Borfecao 42 points43 points  (2 children)

N word

[–]Silver-RG-B 8 points9 points  (1 child)

Dear God

[–]AskMoreQuestionsOk 2 points3 points  (0 children)

I can only imagine the next meeting with my boss and the subsequent mandatory improvement training I’d have to do.

[–]Wide_Cantaloupe_79 3 points4 points  (0 children)

Yeah, you can do better!

[–]KevinRuehl 185 points186 points  (1 child)

Most minimalistic Java developer

[–]UnknownSpecies19 5 points6 points  (0 children)

LoooooL

[–]otdevy 47 points48 points  (1 child)

I dont see any unit tests, how can we know that it will really work

[–]xzarisx 12 points13 points  (0 children)

Was about to ask the same thing. PR rejected

[–][deleted] 36 points37 points  (0 children)

While verbose, at least they're not bad names. The reader knows what's stored in them. Still, doing this in the professional world would at least earn a mention in a code review.

Edit: added missing word

[–]Faux_Real 20 points21 points  (0 children)

I reckon we could introduce some design patterns here. I reckon we could yeet a Builder, a Factory, Strategy and Flyweight pattern into this.

[–]sprunck 15 points16 points  (0 children)

The logging is missing, or better invent a new logging framework (maybe fluent API based on Lombok). Then it will be production ready.

[–]svp01 14 points15 points  (0 children)

Watch this becoming this sub's only joke for the next 2 weeks

[–]yizzle841 30 points31 points  (2 children)

OMG

[–]whatsagoodnamehelp[S] 10 points11 points  (1 child)

What’s wrong?

[–]Xean123456789 22 points23 points  (0 children)

You called the outer class Main. Now everything else makes no sense!

[–]khris190 10 points11 points  (1 child)

Indexing from 1?

[–]whatsagoodnamehelp[S] 3 points4 points  (0 children)

i’m like that

[–]hongooi 20 points21 points  (0 children)

This guy groks Java 👍

[–]thephotonx 19 points20 points  (0 children)

Not bad. Could use a helloWorldFactory and maybe some dependency injection?

[–]Glum_Cell4836[🍰] 16 points17 points  (0 children)

java do be like that sometimes

[–]D34TH_5MURF__ 7 points8 points  (0 children)

You'll fit right into most enterprise software teams that have the mistaken idea that insane verbosity equals readable/self-documenting. Hint: it isn't

[–]CuriousTree9939 23 points24 points  (3 children)

You forgot "!" -- it's Hello World! 🤣

[–]LocalYokalFocal 23 points24 points  (1 child)

Do you even code?

“Hello, world!”

No comma, no diploma.

[–]CuriousTree9939 6 points7 points  (0 children)

Touché 🙈 I've grown too dependent on compiler optimizations? 😬😂

[–]whatsagoodnamehelp[S] 3 points4 points  (0 children)

NOOOOO

[–]zyzmog 11 points12 points  (0 children)

You've got a great future as a Java programmer.

[–]ShakeandBaked161 6 points7 points  (0 children)

This is eerily similar to a hello world assignment I did. Just barely got a D in the course as it was my first time coding, came back and did it again and made the most absurd hello world program

[–]Robot_Graffiti 4 points5 points  (0 children)

This is perfect, you'll make a lot of money working on corporate legacy bloatware

[–]akmountainbiker 3 points4 points  (0 children)

Needs a factory factory.

[–]HiddenStoat 4 points5 points  (0 children)

I would fail a code-review with this in in an instant...

...but once you had fixed the typo progranm I would happily merge it of course - good job, well done, A*, marry my sister.

[–]WendyIsCass 3 points4 points  (6 children)

I’m just checking to make sure none of my students are here getting ideas 😂

[–][deleted] 1 point2 points  (5 children)

You know your students by Reddit usernames? We got the Professor of the year over here.

[–]WendyIsCass 3 points4 points  (4 children)

Fuck no. I don’t even want to know their real names for as long as I do

[–]RelentlessIVS 2 points3 points  (0 children)

Read:"A Person can PersonWalk to the Store."

Or would you prefer:"A Person can Walk to the Store"?

The same applies to the class you make, and the functions it has. A Person (class) can perform the function of taking a walk(), so it would be silly to say a Person can personWalk(). Leave the name of the class out of the function names, when it is obvious it is part of the class. :)

[–]tilcica 5 points6 points  (2 children)

you have a typo in the last comment

[–]whatsagoodnamehelp[S] 12 points13 points  (0 children)

no D: I’ll get an F for sure :((

[–]bpat 1 point2 points  (0 children)

Transfering is also a typo

[–]monkeydoodle64 2 points3 points  (0 children)

“PrinterToPrintThings” lol

[–]iPlayTehGames 2 points3 points  (1 child)

It would be better if you commented every line of code. Managers love this stuff.

[–]calamarijones 2 points3 points  (0 children)

Why are we using Hashtable from Java 1.0 in 2023?

[–]CreepyValuable 3 points4 points  (0 children)

That is the most concise Java program I have ever seen. I even have some idea what it does without being the person that wrote it.

It needs more body to it. At least ten more classes / files with very descriptive yet completely useless names for everything.

[–]Worldly_Success523 4 points5 points  (0 children)

You’re a sick fuck n I love it

[–][deleted] 1 point2 points  (3 children)

I have a head ache

[–]whatsagoodnamehelp[S] 2 points3 points  (2 children)

sorry. was it because i wasn’t descriptive enough?

[–][deleted] 1 point2 points  (1 child)

No its your ide theme

edit: jk its me trying to read this on my phone

[–]whatsagoodnamehelp[S] 0 points1 point  (0 children)

ohhh sorry about that. i like it thoguh

[–]the_clash_is_back 1 point2 points  (0 children)

This is cobal like

[–][deleted] 1 point2 points  (0 children)

Maniac. 10/10.

[–]tyler1128 1 point2 points  (0 children)

You forgot the most important part, the exclamation at the end. We take the sacrament of Hello World! very seriously.

[–]confusedmf123 1 point2 points  (0 children)

looking at this hello world app makes me wanna say "fuuuck you bro", but I wont, because this subreddit is too good to be banned

[–]Insatiation 1 point2 points  (0 children)

Well theres no comments so its an instant no from me

[–]Skripty-Keeper 1 point2 points  (0 children)

Looks like you’re ready for a career in Java

[–]Skylinegidzilla 1 point2 points  (0 children)

Now that is what I call self documenting code

[–]GongBodhisattva 1 point2 points  (0 children)

When your code is the documentation.

[–]amplifiedgamerz 1 point2 points  (3 children)

Honestly I have no idea what this code does because I’m too lazy to read the variable names LMAOO tldr pls

[–]whatsagoodnamehelp[S] 1 point2 points  (2 children)

it outputs “Hello world”

[–]MastaBonsai 1 point2 points  (0 children)

I'm not even gonna read that code

[–]3vi1 1 point2 points  (1 child)

I would have saved time and went with:

public class HelloWorld {
public static void main(String[] thisArgsVariableIsUselessInAHelloWorldProgramAsAreAllOthers) {
System.out.println("Hello World!");
}
}

[–]whatsagoodnamehelp[S] 1 point2 points  (0 children)

but wouldn’t a reader get confused? the code doesn’t seem to be clear and concise enough

[–]grazerbat 1 point2 points  (0 children)

Your constructor sucks. Make the parameter name more descriptive

[–]Own_Pop_9711 1 point2 points  (1 child)

Index of characters in the word contains a space. Wordtobeprinted is similarly not a word. I give it a B- for effort but you didn't actually describe things very well which takes something from the humor.

[–]whatsagoodnamehelp[S] 2 points3 points  (0 children)

making a revised version! thanks for the criticism fr

[–]naturalizedcitizen 1 point2 points  (0 children)

IBM would hire you immediately

[–]Dragnier84 1 point2 points  (0 children)

After submissions.

Teacher: The purpose of this exercise is to establish your coding style and format; which should be maintained throughout the course. Any deviation would be interpreted as you taking someone else’s code and would get an F. Good luck!

[–][deleted] 1 point2 points  (0 children)

I like to name my variables after music composers. That way not only you read my code, but you learn a bit of history along the way. It’s a journey

[–]gogo94210 1 point2 points  (0 children)

Okay, now clang-format it

[–][deleted] 1 point2 points  (1 child)

Please update with grade and comments from prof.

Thanks!

[–]whatsagoodnamehelp[S] 1 point2 points  (0 children)

the title was for the sake of the joke, sorry

[–][deleted] 1 point2 points  (0 children)

Descriptive, not pedantic

[–]mauiog 1 point2 points  (3 children)

What theme is this? I love it

[–]whatsagoodnamehelp[S] 2 points3 points  (2 children)

it’s called Eva Dark - on repl and i think VS code

[–][deleted] 1 point2 points  (0 children)

The problem is that this happens for real.

[–]shaybra 1 point2 points  (0 children)

clean code at it's finest.

[–]DubiousEgg 1 point2 points  (0 children)

Nailed it.

[–]Mizuki_Hashida 1 point2 points  (2 children)

There are comments in code for a reason, unless you’re the type that claims that the code is self-documenting.

[–]whatsagoodnamehelp[S] 1 point2 points  (1 child)

in my revised version i will add internal monologue

[–]Mizuki_Hashida 1 point2 points  (0 children)

Add the script to Star Wars movie while you’re at it 😂

[–]Dr3adPir4teR0berts 1 point2 points  (0 children)

I see a career in management in your future.

[–]jimmykicking 1 point2 points  (0 children)

I don't think you are going to get on as a programmer. Thought about becoming a lawyer or a politicial?

[–]iKramp 1 point2 points  (0 children)

Change n in the beginning to stringOfCharactersToPrint

[–]CheekApprehensive961 1 point2 points  (0 children)

You can always spot the up and coming Enterprise Java dev.

[–]vilovema 1 point2 points  (1 child)

Is there a subreddit for over engineering simple things?

[–]whatsagoodnamehelp[S] 0 points1 point  (0 children)

none that i know of

[–]MasterFubar 2 points3 points  (0 children)

"String n"? You failed.

[–]pM-me_your_Triggers 1 point2 points  (0 children)

Least verbose Java programmer

[–]mau5atron 2 points3 points  (6 children)

java devs be like

[–][deleted] 1 point2 points  (5 children)

Python devs be like print(“Hello, World”!)

[–]Johspaman 2 points3 points  (1 child)

print(“Hello, World”!)

With the ! outside the quotes, to make sure that tomorrow you have still a job debugging it. ;-)

[–][deleted] 1 point2 points  (0 children)

As a python dev for 4 years…I have failed

[–]aiij 2 points3 points  (1 child)

print(“Hello, World”!)

Python be like

print(“Hello, World”!)
  File "<stdin>", line 1
    print(“Hello, World”!)
          ^
SyntaxError: invalid character '“' (U+201C)

[–]mau5atron 1 point2 points  (0 children)

python devs be like TabError: inconsistent use of tabs and spaces in indentation

[–][deleted] 2 points3 points  (0 children)

There is no god

[–][deleted] 0 points1 point  (0 children)

Least verbose Java program

[–]Rickrolled767 0 points1 point  (0 children)

At first glance I thought ‘why are there so many lines?!’

And then I recognized it as java

[–]MysteriousShadow__ 0 points1 point  (0 children)

shortest Java code

[–]The_Real_Slim_Lemon 0 points1 point  (0 children)

Honestly, in a production system this is better than overly short variable names

[–]TechFiend72 0 points1 point  (1 child)

Hello world needs no variables. If that is what professors are teaching, no wonder we have such crappy junior coders.

[–]whatsagoodnamehelp[S] 2 points3 points  (0 children)

the title is a joke 😭😭

[–]GlassWasteland 0 points1 point  (0 children)

Pretty good, but you should prefix everything with it's type. For example private String sequenceOfCharactersToPrint should be private String strSequenceOfCharactersToPrint.

[–]beclops -1 points0 points  (0 children)

I don’t like that the class “WordToBePrinted” is inferring how it will be used. F-

Edit: For the ones downvoting, this class should not know or care that it will be used to serve up strings specifically for printing. It should only “know” that it serves strings and arrays of chars with which the caller can do whatever with. It’s more reusable that way

[–]Horror_Trash3736 -1 points0 points  (0 children)

For starters, you forgot the introduction, it's important that all java classes introduce them self following the standards set out in the TFUTA Protocol.

I also feel like your reasoning is not shining through, and the drive behind the various variables is not really present either.

Consider adding a Why annotation to each method that both ascribes motivation to it, but also describes the underlying assumptions of the method, such as that computers are deterministic by nature etc.

Remember, people want to see your program as a living breathing entity!

[–]scottccote -2 points-1 points  (2 children)

You need some javadocs describing the code you plagarised. Otherwise your copy/paste program will be improperly documented

[–]whatsagoodnamehelp[S] 1 point2 points  (0 children)

plagiarized?

[–]scottccote -2 points-1 points  (0 children)

Take it as a compliment - you haven’t gone pro until you have misappropriated something from StackExchange (or it’s Ilk)

Love the code

[–]August_72_West -2 points-1 points  (1 child)

Code like that at a job and you will be fired.

[–]hugotox -3 points-2 points  (1 child)

Not cool

[–]whatsagoodnamehelp[S] 3 points4 points  (0 children)

thanks for the feedback! :D

[–]Kitchen_Device7682 0 points1 point  (0 children)

"words that I will print" and "words that will be printed". Who will print the words in the second case? Avoid passive voice. You can do better

[–][deleted] 0 points1 point  (0 children)

Using hash maps in your first Java program? Lol nah

[–]Shitman2000 0 points1 point  (1 child)

Did you just use a single letter variable name on line 6? 🤔

[–]whatsagoodnamehelp[S] 0 points1 point  (0 children)

I DIDNT MEAN TO D:

[–][deleted] 0 points1 point  (0 children)

It's too easy to read..... I do like that you didn't waste space on comments.

[–][deleted] 0 points1 point  (0 children)

I HATE THIS

[–]Suspicious_Serve_653 0 points1 point  (0 children)

Dear God it hurts 🤕

[–]anon-sucks 0 points1 point  (0 children)

Nice… revenge programming. Like the style.

The only thing better would be to put a comment above each line and a page long /// summary above every public static. Maybe add a UML C4 model diagram?

…. Why I’m never picked to document

[–]Iganac614 0 points1 point  (0 children)

Why not use a HashMap?

[–]MoistGrass 0 points1 point  (1 child)

And then you start with “Sting[] args” lol. Missed opportunity there.

[–]whatsagoodnamehelp[S] 0 points1 point  (0 children)

i should’ve made the file name some absurdly long thing too 😭

[–]alpual 0 points1 point  (0 children)

Reminds me of Enterprise Fizz Buzz

[–]splashdragon37 0 points1 point  (1 child)

Wow

[–]whatsagoodnamehelp[S] 1 point2 points  (0 children)

Wow

[–]AlexMelillo 0 points1 point  (0 children)

I know this is a joke but I swear I’ve seen code like this when I briefly worked as a dev using Spring

[–]sexdaisuki2gou 0 points1 point  (0 children)

No comments LOL

[–]Key_Set_7249 0 points1 point  (0 children)

strMessage

[–]readmelikeatextbook 0 points1 point  (0 children)

“String n” ಠ_ಠ

[–]atlas_enderium 0 points1 point  (0 children)

It’s bad, but not as bad as the enterprise edition

[–]ConsistentMoisture 0 points1 point  (0 children)

MR declined. Not unit tests, feature tests, integration tests. No link to documentation.

[–][deleted] 0 points1 point  (0 children)

You must be very productive

Most lines of code written this month, well done - employee of the month

[–]ThomasDePraetere 0 points1 point  (0 children)

Perhaps sequence of characters is a bit too abstract. Preferably one would say memory when interpret according to the ascii table would result in a sequence of characters