Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

371–380 of 777 posts

Re: Java 21 makes me like Java again

#371

Earlier quoted context omitted.

That's basically what c# has done. But it's implemented as a warning which can be upgraded to an error. I think it might even be an error by default in new projects now.

Holy shit, how didn't I know they'd taken it this far? This is great! https://learn.microsoft.com/en-us/dotnet/csharp/nullable-ref... They actually fixed the billion dollar mistake...

They didn't. A proper fix would require getting rid of null altogether in favor of ADTs or something similar. I work with C# daily and nulls can still slip through the cracks, although it's definitely better than @NotNull and friends.

I haven't worked with Kotlin in a while, but IIRC their non-nullable references actually do include runtime checks, so you cannot simply assign null to a non-nullable and have it pass at runtime like you can (easily) do in C#.

Re: Java 21 makes me like Java again

#372

[flagged]

I agree, Java is wordy, ritualistic, and prone to overcomplication. Build/run/write loops are slow and painful, and frameworks and toolkits try to do so much that they inevitably get in the way.

Not by that much... the problem is Java's build systems. Theyre what complicate and slow down java development 90% of the time.

Re: Java 21 makes me like Java again

#373
post #200

Earlier quoted context omitted.

As someone writing code on Java since v1.0 and making tech strategy decisions on the C-level, I consider myself sane and experienced enough to say that Java is something that will do the job well and can be the primary choice for startups and new projects. Kotlin as a platform is not mature enough to deserve the same qualification.

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.

Re: Java 21 makes me like Java again

#374

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.

That is true, but there are many who have discussed that. I wanted to bring some attention to the new syntactic changes Java brings that can help with implementing better logic.

Re: Java 21 makes me like Java again

#376

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…

Wondering if anyone is using JRuby on Rails in production.

Re: Java 21 makes me like Java again

#377

Earlier quoted context omitted.

My main pet peeve with Golang is to use single letter or very short abbreviations when naming variables. The Golang documentation recommends what is considered a bad practice by most programmers communities.

Yes, short abbreviations are brutal in long sprawling code contexts. Write in a compact, functional, and readily unit testable coding style, and those tiny variables reduce your cognitive load and bring great clarity. Use comments and/or docstrings to provide context for compact parameters and local variables once, rather than implicitly documenting with every usage.

>Use comments and/or docstrings to provide context for compact parameters and local variables once, rather than implicitly documenting with every usage.

Context that isn't documented with every usage is context you need to remember. Trade off, but I'd much rather not have to remember multiple contexts for the same name every few hundred lines.

Re: Java 21 makes me like Java again

#378
post #2

Nice article as someone familiar with sum types but not sum types in Java. I don't know if sum types alone are enough to get me to like Java, pervasive nullability is still around and even rears its head multiple times in this article.

With valhalla, we will have explicit nullability as well, so that problem will also be handled.

Re: Java 21 makes me like Java again

#379

> Why do we call them product types anyway? Answer in the piece is not wrong, but put more intuitively and succinctly: the total number of possible value (inhabitants) in a product type is the product of the quantity of inhabitants of the constituent types. Replace the “product”s with “sum”s and it works too. Interestingly, the total number of unique functions (judged only in terms of input and output) from a -> b ca…

Ill add that in, somehow forgot about that golden bit of info

Re: Java 21 makes me like Java again

#380

Sad this gets to front page while a blog post which documents that .NET 8 has 200 A4 pages worth of performance improvements gets absolutely ignored. C# keeps being the language people are looking for but don't know about.

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 expects you to develop on Windows. Which makes sense... for them.
Post reply on HN