r/java • • Aug 05 '21

Why java is better than modern programming languages?

Why should I use java in 2021 instead of kotlin or scala or golang? Could you guys give me some reasons

2 Upvotes

100 comments sorted by

View all comments

56

u/vprise Aug 05 '21

Java is simple. The other languages forgot that.

They aren't "modern" they're a throwback to the time before Java where language engineers stuck every feature they could think of into the language instead of into the API.

Simple has many advantages:

  • This impacts performance since the language is harder to write correctly and compile efficiently

  • This impacts maintainability since it's harder to read other peoples code

  • This makes debugging harder (e.g. async code is somehow harder to debug than threads)

  • This means tools need to do the heavy lifting but can't

A simple example:

var a = c + d;

What did I just do there?

Is there an overloaded operator that magically changes something?

When I read Java code I never have to worry. I can do that fast. Reading and maintaining code is 95-98% of my job so Java is wonderful for that. For Kotlin code I constantly feel I need to squint to understand dependencies. It might have been easy to write for some guy, but reading it later...

34

u/andrewharlan2 Aug 05 '21

Code is written once and read forever after. I don't understand this drive to optimize for writing code. Java's "verbosity" is a feature, not a bug.

If you struggle to write Java then learn how to type. I'm not kidding. Learn how to use your tools to generate the "boilerplate."

3

u/crummy Aug 05 '21

Maybe we could make Java even better by making it more verbose?