this post was submitted on 15 Jul 2023
1216 points (98.9% liked)
Programmer Humor
19503 readers
1263 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Is this a good thing I’m looking at or a bad thing? I don’t get it but then again, I’m not a programmer.
The joke is Java is verbose. It takes many characters to accomplish simple routines. Depending on your view that could either be good or bad for reading the code later.
Sure, but most of the lines in the screenshot break down to:
object1.setA(object2.getX().getY().getZ().getI().getJ().getK().getE().getF(i).getG().toString())
Aside from creating a method inside the class (which you should probably do here in Java too) how would another language do this in a cleaner way?
Kotlin would represent the getter/setters as synthetic properties (and do so automatically, since Kotlin interops with Java).
Of course it's still not great (there's still too much nesting, there's something fundamentally wrong with how the data is structured) but at least the code is less noisy.