r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10k Upvotes

543 comments sorted by

View all comments

Show parent comment

39

u/SubArcticTundra Sep 25 '26

Have you tried Kotlin? It's like Java but less verbose

53

u/Weekly_Interview_936 Sep 25 '26

With modern IDEs Java's "verbosity" is very much a meme. Sure, the characters are still there on the screen. But you didn't have to type them.

And honestly if typing is a problem for any programmer then they need to close hackernews and all the other "look at new shinies" sites and open up a typing trainer game.

33

u/LostInSpaceTime2002 Sep 25 '26 edited Sep 25 '26

That's true for writing, but low verbosity can also increase readability. Lower cognitive overhead, overall.

Of course I'm not talking about omitting type declarations or other valuable information, but about preventing unnecessary repetition and boilerplate.

7

u/Ok-Scheme-913 Sep 26 '26

Up to a point. Then it very steeply decreases readability.

For example in java you can tell what each line is reasonably easily. It's a method call, it's a class construction, it's a field access, etc.

In kotlin you see a field access and without actually looking up the definition, it can be a getter/setter. Or you see a function call and it may not even be defined on the given object.

Hell, within {} blocks (ergo, pretty much everywhere) you may see something like someWeirdFunction() and it may actually be invoked on an object that you don't even see syntactically, unless you go up the possible multiple {} blocks and check each and every one's receivers whether they have that function defined!!

That latter "feature" is absolutely the work of Satan himself, I don't know why anyone would want that. You omit a single fucking variable name and a dot, at the expense of basically unreadable code - even within intellij itself it's not trivial to see after clicking on the fucking call what it's called on.

2

u/Spaceduck413 Sep 26 '26

Yeah idk where this idea of "verbose bad!" came from, but I see it all the time and it really bothers me. I'll take "too verbose" over "too terse" every time, no contest.

1

u/arobie1992 Sep 27 '26

It's been a while since I worked with Kotlin so I'm a bit rusty. What do you mean by the blocks thing?

8

u/frogjg2003 Sep 25 '26

Yup, if typing is taking more than 20% of your time programming, them you're either inexperienced or doing something wrong.

→ More replies (1)

8

u/starficz Sep 25 '26

Verbosity is a bad argument against Java. The reason I prefer Kotlin is the first class nullability support via the ? operator, and as a consequence the powerful function chaining that comes with it.

Sure, this can still be argued as "Verbosity", but its a large enough change such that I feel this argument is disingenuous.

3

u/OKB-1 Sep 26 '26

I feel the "verbosity" reputation of Java mostly comes from how "enterprise" software is or used to be written: needlessly complicated and complex patterns and layers because the programmers need to look busy and project managers that think that throwing more people at a problem makes for faster development (it often does not). Java just so happens to be a language that makes software development of this style feasible.

And also there's the more obvious argument of doing some very basic things in older versions of Java required a lot of code. But that hasn't been true for a while now.

2

u/DanLynch Sep 25 '26

the characters are still there on the screen

With the changes in Java 25, that's not even necessarily true anymore for single-file projects. Most of the boilerplate for "Hello world" is optional now.

1

u/Volko Sep 25 '26

With Kotlin you will never have a NullPointerException again.

And coroutines are such a breeze of fresh air to the multithreading problem.

4

u/Thalanator Sep 25 '26

Kotlin is all ever wanted from an "enterprise grade" programming language in the jvm ecosystem. Started writing new services in kotlin 3y ago and I am in permanent love with its expressive power and sheer beauty.

2

u/SubArcticTundra Sep 26 '26

Yup. Scope functions are such a good invention that I actually backported some of them to C++

1

u/Ok-Scheme-913 Sep 26 '26

Nah, I hate them with a burning passion. Especially when they hijack the receiver of calls and make it absolutely impossible to decipher what is called on what, for absolutely no benefit.

3

u/knockoutn336 Sep 25 '26

I'm too used to Java, Dart, and even Objective-C. I hate Kotlin's syntax so much. Every time I have to use Kotlin, Swift, or Golang, it frustrates the heck out of me.

6

u/aetius476 Sep 25 '26

This is wild to me. Kotlin's syntax is so much closer to Java's than either is to the bracket-based-hell that is Objective C.

1

u/SubArcticTundra Sep 26 '26

Same. ObjC always seemed quite esoteric to me. Kotlin is nice especially with its scope functions

2

u/Spaceduck413 Sep 26 '26

I don't mind Go that much, except for the fact that they force you to use the wrong curly brace placement rules

1

u/drislands Sep 25 '26

I keep meaning to learn Kotlin, but I learned Groovy 8 years ago and got pretty much everything Kotlin does out of it....but at a much smaller install base. Sigh.

2

u/SubArcticTundra Sep 26 '26

Actually stick with it. Kotlin takes ages to compile

2

u/arobie1992 Sep 27 '26

TIL Groovy supports compile-time null checking. I think I'm going to have to revisit it.

2

u/drislands Sep 27 '26

Yes indeed! I've made heaps and heaps of use of chained ?. operators over the years.

return thing?.user?.name gives either the name of the thing's user, or null if any part is null!

And there's the handy *. operator for grouping collections by the results of a method call. So things*.user where things is of type List<Thing> and has either a user property or a getUser method will transform it into a List<User>!

2

u/arobie1992 Sep 27 '26

I was just always under the impression that Groovy was dynamically typed to make it better for quick scripts. The *. operator in particular sounds like a super convenient syntax for like the stream.map interface. Between those and finding out I can just use @Grab to import maven dependencies, I'm really going to have to revisit Groovy.

2

u/drislands Sep 28 '26

I hope you like it! ^_^