Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

681–690 of 777 posts

Re: Java 21 makes me like Java again

#681
post #457

Earlier quoted context omitted.

I don't think any existing Go developer is going back to Java. I worked with Java for 10 years and switched to Go and I will never go back. This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. Go is simple. It's easy to understand, read, and maintain. The packaging is like how you would package files on your co…

Go has made many decisions that i'm not happy about. If they did one thing exactly right on the language level, it's the [lack of] OOP: interfaces in their implementations, and no inheritance, overridden methods, covariance / contravariance games, etc. You can of course write in Java in that style: only extend interfaces, never inherit classes. But many libraries, including the standard library, actively refuse to co…

Do you mean overloaded methods? You can "override" methods in Go in the sense that if you have an embedded struct you can provide your own implementation in your struct to use instead

Re: Java 21 makes me like Java again

#682

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 don't think any existing Go developer is going back to Java. I worked with Java for 10 years and switched to Go and I will never go back. This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. Go is simple. It's easy to understand, read, and maintain. The packaging is like how you would package files on your co…

I use Go and Java every day, and Java is way more enjoyable to use

Re: Java 21 makes me like Java again

#683

Earlier quoted context omitted.

I don't think any existing Go developer is going back to Java. I worked with Java for 10 years and switched to Go and I will never go back. This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. Go is simple. It's easy to understand, read, and maintain. The packaging is like how you would package files on your co…

This is correct. It is about culture too. Java is the kind of language that attracts some mediocre programmers who produce mediocre code based on the wrong ideas of object oriented programming. of course, there are great Java programmers. It is just that a better programming language would help average programmers like us to achieve more

Despite the fact that this is a claim with no basis in reality, what you are saying is that people who don't understand the core concepts the language is built on write bad code...Isn't that true for every language?

Re: Java 21 makes me like Java again

#684

Earlier quoted context omitted.

C# is a better language, but the JVM is a significantly better ecosystem. Java will always be behind (and type erasure for generics is annoying enough as someone who started in C# that I don't think it will ever catch up) but between hotspot and being the preferred language of 2/3rds of the clouds I think it clearly wins.

Type erasure is why there's such a rich ecosystem of 3rd party languages that run on the jvm.

Meaning that it would be harder for those languages on the clr because of generics? Would typing all generics as Object not be essentially equivalent?

Re: Java 21 makes me like Java again

#685
post #645

Earlier quoted context omitted.

> Too many allocations for Go is going to be too many allocations for JVM too No, Go’s GC is a toy compared to the JVM’s. It is lowerish in latency by actually stopping the application threads when under high contention. Java doesn’t slow down the allocation rate, it tries to keep up with the churn.

I’d love to see you elaborate on this. Anecdotally, my experience was the exact opposite. Is there some documentation making this point? In the course of optimizing I came to know the various JVM GC algos (concurrent mark/sweep, parallel old, etc) by the corresponding memory graph alone. I never, ever had to debug similar latency in the Go stack.

>> (concurrent mark/sweep, parallel old, etc)

Both of those are only picked for low sized heaps with few cores, probably within a container. Were these micro services?

G1 is the default for larger heaps and multiple cores, and ZGC and Shenandoah (low latency GCs) have to be manually turned on AFAIK.

OP said:

>Java doesn’t slow down the allocation rate, it tries to keep up with the churn.

This is incorrect. ZGC will block a thread when it cannot give a thread any memory, because it can't collect and free memory at the pace needed. Google "allocation stall" for this. ZGC can achieve very low latencies akin to Go's GC, I don't know if the throughput is higher or not. Multiple cores and some GiB of heap space is when ZGC will shine.

Re: Java 21 makes me like Java again

#686
post #135

[flagged]

So which is the real programming language one should use in the God's year, 2023? (Will it change in 4 months also?) > virtual threads but you still have threadpools and os threads As opposed to what, quantum entanglement threads? > No one really enjoys debugging your call stacks Frankly, debugging has probably the very best tooling around the JVM -- so, what exactly is your chosen favorite that would be supposedly b…

Yeah, I dislike Java more than most but picking on its debugging story is laughable: it’s tooling around that is excellent

Re: Java 21 makes me like Java again

#687

Earlier quoted context omitted.

No idea why you are comparing Java, which is BE, to React, which is FE. I think I will check Java once they finally make coroutines… I mean “virtual threads” a stable feature. That actually looks exciting… being able to parallelize almost like in Go 5 years ago.

>finally make coroutines… I mean “virtual threads” a stable feature Don't you mean fibers? Anyway, I'm pretty sure it's targeted to JDK21.

Fibers are now called virtual threads

Re: Java 21 makes me like Java again

#688
post #114

Earlier quoted context omitted.

Except I’m over here serving 10x the traffic with 10x less cloud spend on CPU and Memory for hosts.

In what language would that marvel be? I give you the less memory....

Go has goroutines which have better cpu and memory than threads which are commonly used in java.

Java is now catching up with go and adding virtual threads which in september 2023 will have the same ease of use as go had in … 2007?

But as I wrote above, it migh really get me to check java again.

Re: Java 21 makes me like Java again

#689
post #482
post #329

Earlier quoted context omitted.

Java's build times are very fast. Java's build tools are anything but. And I'm surprised no one is doing anything about it.

Gradle, when the daemon is runnning is very fast, people just often fck up their build scripts to include config-time run functionality, which is just all around a stupid thing to do. It only ever runs tasks that actually have to be run, has integration with javac, can work in parallel, and even has cross-company build caches if needed. Also don't forget that Java can do hot reloads with the debugger, or with tools l…

Gradle is anything but fast

Re: Java 21 makes me like Java again

#690
post #200

Earlier quoted context omitted.

I'm sure you have done great work in Java, as have many of us, and for many of those years, Java really was the best tool for many jobs. But that was then, now is now. I'm not saying Java doesn't work, even for greenfield projects today. It works fine. But me and many others also think it's not enough for something to merely work, especially not when there are other much better and more modern tools. (which Java is d…

> I've worked with the kind of engineers who are still doing Java + Spring like it's still the 90s, and they're not the ones you want on your projects And I've worked with programmers who use the latest fad of the day (golang, etc) and they're not the ones you want to have on your projects. > The best talent don't even want to consider working with Java if they can help it. Not in my experience.

Every single person who's arguing against Kotlin in this thread is resorting to the argument that it's the latest fad of the day. It's not.
Post reply on HN