Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

71–80 of 777 posts

Re: Java 21 makes me like Java again

#72

The biggest feature in Java 21 is the release of Virtual Threads: https://openjdk.org/jeps/444 For some reason, this is missing from the article. If there was any feature that would sway existing Golang developers to switch to Java, it would be this. It would perhaps also convince the haters of the reactive-style concurrency patterns.

I wonder what will happen with these patterns now. They seem to have been invented to work around the problems with regular threads. Will new patterns emerge, or will the reactive patterns be ported to run on virtual threads?

Re: Java 21 makes me like Java again

#74

[flagged]

This ... is how you make engineering choices?

At work, I have a different context. What is the common denominator of what people know. Personally, the “write once, run everywhere” notion of Java has been replicated with much more productive languages.

Re: Java 21 makes me like Java again

#75

Earlier quoted context omitted.

I rarely see inheritance used in practice in java code bases. Except where I would use a union type or sealed class in other languages anyways. I don't feel what youre describing is a real issue.

> I rarely see inheritance used in practice in java code bases. That seems absurd to me and I have a hard time understanding it, honestly.

If you type everything with interfaces in your codebase, you are much less tied to inheritance. In fact, everyone could be written to be composed.

However Java doesn’t support type union so you can get into some ugly and verbose situations but the JVM doesn’t really check type so this is more a compile-time issue and could be fixed in a future Java language revision.

Re: Java 21 makes me like Java again

#77

Earlier quoted context omitted.

I rarely see inheritance used in practice in java code bases. Except where I would use a union type or sealed class in other languages anyways. I don't feel what youre describing is a real issue.

> I rarely see inheritance used in practice in java code bases. That seems absurd to me and I have a hard time understanding it, honestly.

> I rarely see inheritance used in practice in java code bases.

Without some specific call-out, it can be assumed that this is a very niche viewpoint that has no bearing on modern development.

The vast majority of projects use inheritance, today.

Does it use Spring? extends SpringBootServletInitializer

Meaningful responses using values from a request? extends OncePerRequestFilter

Formatting exception handling responses on web requests? extends ResponseEntityExceptionHandler

Then there's all the interfaces you have to satisfy, because it's all tied into the standard library and popular libraries.

Re: Java 21 makes me like Java again

#78
post #54
post #22

Earlier quoted context omitted.

do/i/still/need/to/create/sub/directories/for/the/things/i/want/namespace?

Only if you're using vim like someone from the 70s, otherwise any sane IDE handles those things for you But, yes, namespaces are still mapped to paths, it's not like they rewrote the JVM to use blockchain or something

Yeah I really like my IDE doing stuff in the background without me knowing shit about it.

Re: Java 21 makes me like Java again

#79

The biggest feature in Java 21 is the release of Virtual Threads: https://openjdk.org/jeps/444 For some reason, this is missing from the article. If there was any feature that would sway existing Golang developers to switch to Java, it would be this. It would perhaps also convince the haters of the reactive-style concurrency patterns.

`Executor.newVirtualThreadPerTaskExecutor` versus `go` really gets to the heart of why I think that Go developers aren't going to be switching.

edit: Sorry, it's actually:

    try (var executor = 
        Executors.newVirtualThreadPerTaskExecutor()) {
       executor.submit(...)
    )
instead of `go`

Re: Java 21 makes me like Java again

#80

Can you convince me to use Java? I’ve never used it (only C++, Python, CL) but it feels bloated and dirty.

Throughput in Java can be quite high, and latency can be quite low. You still occasionally get latency spikes from the GC, but these days that's not so bad. (If you are extremely latency sensitive, stick to C++). Dependency injection frameworks are your bread-and-butter in server-side Java, and some can take a while to grok, but Java can be very productive after the chosen framework "clicks" for you. Typically, this…

> Java can be very productive after the chosen framework "clicks" for you.

you can chose to not use DI frameworks at all..

Post reply on HN