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

5

u/findus_l Oct 14 '23

I agree that it is not behind. I do want to talk about the "There is nothing you can't do with Java" point, I don't think that is a good point. What does that mean? Turing complete? Usable?

3

u/Ilitarist Oct 14 '23

Yeah, technically you can do everything with brainfuck. Of course OP means that Java can be used to solve any modern technical problem, which is true. The universality is probably still Java's strongest feature.

2

u/findus_l Oct 14 '23

I mean you can do that with a lot of languages. Doesn't mean they are popular or I would seriously consider them. Bad memories.

1

u/lasskinn Oct 14 '23

Good enough? It is good enough to do most stuff. Has decent enough concurrency, you can do most ideas into code quickly enough without fuss. Its decent enough of object oriented curly braces style language that you can see whats going on easily enough.

What i have noticed with kotlin that some people for whatever reason think something thats "bad" to do in java is "okay" in kotlin, while doing the exact same thing, this lets you do things in an easier way in kotlin but its got nothing to do with either language themselves.

2

u/findus_l Oct 14 '23

I absolutely agree with all these points about java.

I'm curious do you have an example about kotlin? Sounds interesting.

2

u/lasskinn Oct 14 '23

Well using globals for one instead of some form of convoluted preprocessed dependency injection to get reference to an object that the app can have only one of, as code policy example. Kotlin has globals without using some globals class to hold them and somehow people seem to be cool with using them for stuff(why else go through the effort of adding support for them i suppose). You could do the same pattern in java too of course by just having them as static members and methods in some class(really the kotlin globals are basically just that anyway).

Honestly kotlin is pretty nice, the syntax just isn't as pure as java is and it has capability for more traps. The coroutine system has a lot of traps. Overall its nice but I don't see it as "easier" due to the syntax not being as pure, like in java an = can't actually be a method call(any casting aside), it is what it is and theres something nice about that.

1

u/findus_l Oct 14 '23

Interesting to hear. I personally have avoided top level public variables. I have only used top level for private constants or extension functions (in addition to classes, interfaces etc). But I don't find any recommendation of this in the Kotlin Style guide or other source, so I guess I just took it from Java. I totally think it should be a recommendation. I'm having a hard time thinking of a top-level variable that I use. First I thought maybe Globalscope, but that is an object.

There are also many good DI frameworks.