Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

241–250 of 777 posts

Re: Java 21 makes me like Java again

#241
post #204
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…

What is “enterprise” use? Plenty of enterprises use Go.

Wow

Re: Java 21 makes me like Java again

#242

Earlier quoted context omitted.

so, which lang would you use personally? > you still have threadpools and os threads. why this is a bad thing exactly?

Golang or Rust. If it’s a web service or microservice: Golang hands down. If it’s a desktop software or game engine, rust. If you just want to typescript your way to success, deno and vite. If you’re too introverted for Rust, Zig. Java, whether it be spring, micronauts, jee, whatever, is wasting CPU and Memory in the cloud costing you and/or your enterprise money.

[dead]

Re: Java 21 makes me like Java again

#243

Earlier quoted context omitted.

You can leak memory in any language. That’s an impossible bar. The problems op is referring to is obviously about memory safety. Java obviously isn’t thread safe like Rust is, but it’s typically safer than C++ on that front too.

Rust isn’t thread safe either. It’s borrow checker will attempt to correct you but you can still run Rust unsafely.

As I understand it Rust's unsafe is designed so you can encapsulate unsafety behind a safe interface.

It's up to the programmer to verify the safety of code using unsafe. But it they do so correctly then you can rely on the borrow checker to verify that everything else is safe.

This means that when you run into a thread safety bug in Rust code you should only have to look at the unsafe blocks to find the culprit.

Re: Java 21 makes me like Java again

#244
post #93
post #78

Earlier quoted context omitted.

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

Yeah, I do like my IDE doing the tedious work for me. It's also really nice to unzip any JAR I need to troubleshoot and know exactly where to navigate to find exactly the file with the code I need. I like Golang a lot but the standardisation and verbosity in Java-land has some benefits after you get used to it enough to learn to ignore the boilerplate, it's pretty good to have some kind of consistency enforced by the…

Yes some C# codebases end up with wildly inconsistent namespacing as you can do anything you like

Re: Java 21 makes me like Java again

#245

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

In the past, when java was dominant and most popular language - sure.

Today though, with languages like js being the most popular one, I would be surprised if inflow of mediocre developers into Java world would be even the same, not to mention higher, then with those more popular languages (Go included)

Re: Java 21 makes me like Java again

#246
post #208
post #204

Earlier quoted context omitted.

What is “enterprise” use? Plenty of enterprises use Go.

By enterprise I mean a lot of features related to data consistency, scalability and integrations. I do not know about go ecosystem, but java and spring have mature solutions that cover the most advanced use cases.

Kubernetes is what I would call very advanced use case.

But that's the thing with Java, yes there are libraries for everything and one could see that as a problem actually.

Spring was mentioned before, but it's the perfect example of an overengineered/ heavy library that does a lot of black magic.

Re: Java 21 makes me like Java again

#247
post #197

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…

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…

This is definitely one of those. “Tell me you don’t know .NET with out telling me you don’t know .NET” moments.

Re: Java 21 makes me like Java again

#248

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…

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 robust before it compiles.

Re: Java 21 makes me like Java again

#249

Earlier quoted context omitted.

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.

F# is far superior to C# as a language. If you are going to jump to the .NET runtime that's the tool to go for.

apples and oranges

Re: Java 21 makes me like Java again

#250

Earlier quoted context omitted.

>” None of the memory problems of C++” I’m sorry, I’m calling BS here. You can still leak memory in Java.

You can leak memory in any language. That’s an impossible bar. The problems op is referring to is obviously about memory safety. Java obviously isn’t thread safe like Rust is, but it’s typically safer than C++ on that front too.

There are two kinds of leaks IMO. The one where your algorithm allocates gigabytes needlessly (and cannot be avoided by language design) and more insidious stuff like having to unsubscribe from an event handler for your object to be dereferenced.
Post reply on HN