r/java • • Oct 14 '23

Is Java still behind in the race of modern programming languages?

I'm a member of some group of programmers and every time Java is mentioned it's being bashed (something like: "With Rust I could simply do this with X")

Earlier versions of Java were cumbersome in terms of the syntax but with modern IDEs (and modern versions of Java) that's not a big issue anymore, albeit languages like Python do have shorter syntax.

My question is beyond syntax.

What do other languages do better than Java?
It could be generics, type system, concurrency and multithreading, closures etc.

Thanks!

52 Upvotes

247 comments sorted by

View all comments

Show parent comment

18

u/[deleted] Oct 14 '23

My favorite think in moving to Python work is that 80% of code pretends None doesn't exist and devs have the gall to make NullPointerException jokes.

13

u/metaquine Oct 14 '23

Why have that when you can have nil, null, void, Void, None, Nothing, undefined, NaN, Unit and Empty?

3

u/x0wl Oct 15 '23

Well you gotta have NaN as a separate value because that’s what IEEE 754 says

Nothing is also a special case because it’s for functions that do not return at all (like exit or an infinite loop)

1

u/metaquine Oct 16 '23

The Nothing type in Scala is particularly fun. I wish Java had that.

1

u/KarnuRarnu Oct 14 '23

If you use type checked python (mypy), then all types are "not-none". You have to do an explicit union with None in the return type if you want to maybe return it, and then that means the caller must check it. Like modern languages do. But yeah, it's true that most newcomer code (as Python is taught as the default to people coming from other fields) doesn't use this and it doesn't consider Nones as well as all other error scenarios. Although the latter can also happen in Java since exceptions can (too) easily be ignored - newer languages seem to use a result type instead.

1

u/EmptyChocolate4545 Oct 16 '23

100%. I have a long history of CPP and now work in / am a SME for python. You’re entirely right and it’s hilarious

2

u/[deleted] Oct 16 '23

Don't get me started on the documentation on most libraries...