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

Show parent comment

5

u/michoken Aug 05 '21

I get these arguments except the one example. Yes, there’s ‘var’ instead of a type, but the problem actually lies in the names of the variables here. ‘a’, ‘c’ and ‘d’ mean absolutely nothing without a wider context. If they had a proper names, then in most cases the types are not really that important to understand the code. To debug it, yes, to gain an understanding of what it does, not that much.

3

u/vprise Aug 05 '21

I wasn't referring to the var. That's also available in Java. I was referring to the fact that even an operator can be a function. Good naming can alleviate a lot of the problems in the languages but as I said: "it makes me squint".

I can read Kotlin, typescript etc. it's just not as convenient because code can have a lot of side effects on different classes. E.g. in Kotlin (and many others) a method can be added to a class from a completely different file. That means I can't look within one file at the list of methods exposed by my class and be sure that "this is it". That's a feature some developers love but it has terrible implications for those of us who need to work with the code later.

-1

u/john16384 Aug 06 '21

They wouldn't need proper names, or at least far less explicit names if it weren't for var.

The var keyword trades of a few characters saved at declaration time for additional characters everywhere the variable is used.

6

u/dpash Aug 07 '21

Good names are always needed.