Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

381–390 of 777 posts

Re: Java 21 makes me like Java again

#381

Earlier quoted context omitted.

It's because C# only "recently" became cross platform in a reasonable way. Hard to overstate the mindshare that it lost for that

And it's still not as cross-platform as Java is, or pretty much all other tech stacks. FreeBSD and commercial UNIXen are not supported at all. If you prefer to develop on macOS or Linux (hi there), you don't get access to many Windows-only tools (mostly for debugging and performance measurement). Microsoft only cares about other operating systems to inasmuch as you can host the resulting application there, but really…

For Linux and macOS you can use Rider and CLI tooling (as expected for most other langs), VS Code is up there but obviously does not come with profiling or advanced debugging tools.

The bias does exist but it's going away, especially that now a lot of developers are moving over to M-series macs.

Re: Java 21 makes me like Java again

#382

Earlier quoted context omitted.

Go's major selling point to me is that you can ship one binary, nothing beats that. Python, Node, Java all have to pre-install lots of dependencies before you can use them, fine for developers, not so great if you want to distribute software for people who are not software savvy, who typically just wants to download one file, install and start using it. c and c++ can also do one executable, but, it is not as portable…

You mentioned "distribute software" but did not consider Electron for Node. You can make an Electron app with JavaScript and ship the binary (or installer) on any platform. It's not a single executable file, but the user experience is the same. I don't think there's an equivalent in Go that allows you build a desktop app like that (with frontend and backend both written in Go)?

> You mentioned "distribute software" but did not consider Electron for Node.

Sorry for the snark, but users will undoubtedly be very grateful to them for not considering Electron.

Re: Java 21 makes me like Java again

#383
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…

That feeling is mutual. I very much prefer boring Java or .NET developers who are all supposedly stuck in the 90s to hipsters chasing after the latest JS fad of the week.

Me too! But you're building a strawman. Kotlin isn't a JS fad. It's been around for many years, is the default language for Android platform and the de facto standard IDE for Java, backed and used by Google, JetBrains and many many others. But sure, everything that isn't what you've been doing since the 90s is a fad.

Re: Java 21 makes me like Java again

#384
post #341

Earlier quoted context omitted.

Go's major selling point to me is that you can ship one binary, nothing beats that. Python, Node, Java all have to pre-install lots of dependencies before you can use them, fine for developers, not so great if you want to distribute software for people who are not software savvy, who typically just wants to download one file, install and start using it. c and c++ can also do one executable, but, it is not as portable…

How do you distribute a Go library? How do you distribute a Go library that has dependencies?

I'm not sure if your question is rhetorical, but Go doesn't have the concept of compiled library that you can link to another binary.

So in Go you make available the library's source code, and the end-user will download it at build time, or vendor it in the source tree.

Re: Java 21 makes me like Java again

#385
post #197

Earlier quoted context omitted.

Exception handling and generics are missing key pieces from go. But adding them will make go look like java. I just wish java would add null safety in the type system in a first citizen way. For enterprise use java has no competitors. You have c# which is microsoft trying to estabilish nash equilibrium fu*ing the developers. I am a bit worried about ever increasing complexity and a steep learning curve, but seems lik…

Java is an inferior language to C#. To get a superior language you would likely have to go for Kotlin. There is no comparison, because Java gets features today that C# had for years. Not even mentioning having to retrofit green threads because adopting async/await (used by TS, Rust, Swift and other languages) is impossible at this point.

You can’t decide language superiority by the number of features. While C# indeed has many cool features, I do think it has already went into C++ territory where all the different, independently cool features have very non-trivial interactions that make it very hard to reason about.

Also, async-await is not a good thing — virtual threads are superior in every way in case of a managed language.

Re: Java 21 makes me like Java again

#386
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…

To build a good product you don’t need a kid with Hollywood star complex, for whom the choice of programming language or tools matters that much. If Java repels such self-proclaimed “best talent”, good, because the team will be healthier without them. There’s enough engineers willing to learn and write a good code on Java to solve a business or an user problem, and they are absolutely not mediocre. There’s even no su…

> To build a good product you don’t need a kid with Hollywood star complex

Agree 100%.

> for whom the choice of programming language or tools matters that much

Programming languages do matter. Serious, mature professionals critically evaluate and compare tools and pick the best one for the job. Kotlin is a) not some fad b) objectively better than Java for pretty much every imaginable use case. Kotlin avoids entire categories of Java defects https://proandroiddev.com/kotlin-avoids-entire-categories-of...

Me and others who advocate for more modern tools are not self proclaimed wannabe rockstar devs who are only interested in the latest fad. Ultraconservative diehards who refuse to learn anything new since the 90s are the ones who need a reality check, not us.

Re: Java 21 makes me like Java again

#387

Earlier quoted context omitted.

Go gives you the illusion of simplicity because it gets rid of guard rails and error checking. If you remove all error checking, of course your code is going to look a lot simpler. It's also going to be a lot more wrong and crashy. Wait until your code base grows, your team grows to >10 developers, and you will understand what I mean. Java (and preferably Kotlin) are a lot more serious about making sure your code is…

I've heard this argument before, and I point out Kubernetes to them. Is that code base complex enough, because it's pure Go doing just fine and runs on plenty of systems?

I mean, that’s pretty much go’s first complex application that was specifically written with that, so don’t think it is a good example.

Re: Java 21 makes me like Java again

#388

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.

Java 21 has me anticipating the next JRuby release because of Virtual Threads. Charles Nutter gave a talk about JRuby in August where he showed a demo of the impact on Ruby fibers and it’s pretty significant. There’s a lot that I really like about the JVM and it’s tooling, I just don’t like writing Java code anymore. JRuby kinda gives the best of both worlds. Here’s the talk. Virtual thread demo is around the 45 minu…

How does jruby relate to truffleruby?

Re: Java 21 makes me like Java again

#389
post #366

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.

> The biggest feature in Java 21 is the release of Virtual Threads Is there a good honest writeup on why is this interesting? Very curious. The earliest JVMs had this, green threads. Performance was terrible so it was eventually dropped. I want to fully utilize every CPU and every core I have, why do I want green/virtual threads again?

The JVM automagically swaps out blocking network calls executing in a virtual thread to a non-blocking implementation, so potentially many other requests can be served in the same time.

So you get the benefit of async frameworks, with none of the negatives: the blocking model is trivial to reason about, read, maintain, and works perfectly with tooling (you won’t get an exception in some WhateveScheduler, but at the exact line where it actually happened. Also, can step through with a debugger).

Re: Java 21 makes me like Java again

#390

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 once posted an Ask HN: what are your build times. A golang developer stated their 25 million line project compiles in less than half a second. If that is really the case, I must say, this is very impressive and potentially a reason to switch from other languages.

Java compiles very fast especially with a running gradle daemon, definitely on comparable levels. It also supports hot reloads to a degree.

Also, was that a clean build?

Post reply on HN