News for hackers. Stuff that matters.
Re:Java 26 is here, and with it a solid foundation for the f... by HendrikHensen on Tuesday March 17, 2026 @04:50PM (#47418094)
What do you mean by "better than Go for industry purposes"?

I don't understand what "industry purposes" means and in what aspects Java is better than Go in your opinion (I can think of some myself, but I'm interested in your perspective).

Re:Java 26 is here, and with it a solid foundation for the f... by kyrra on Tuesday March 17, 2026 @05:01PM (#47418252)
Not the GP, but for really large code bases, Go is missing a few features that I've noticed:

1) No immutable types. My work team is a huge user of immutable data stuctures in Java to make sure data passed around to other teams isn't changed. Go doesn't really have a good way to do this.

2) Refactoring can be really annoying (or at least really noisy) because of public/private being defined by capitalization of method/field names.

3) Error handling isn't great. I love Go's errors being just normal values, but the `error` interface is awkward when trying to figure out what kind of errors can be thrown without having in-depth knowledge of the kinds of errors that can be returned. We regularly need to make different decisions depending on the kind of error returned. Knowing which errors can be returned in Go is not defined by the method being called (only in comments).

Re:Java 26 is here, and with it a solid foundation for the f... by oefrha on Tuesday March 17, 2026 @07:17PM (#47419658)
> No immutable types (in Go)

The typical answer is opaque types with only readonly methods exported. Not elegant, but it’s there. I guess it’s arguably not a “good way” to do it.

Re:Java 26 is here, and with it a solid foundation for the f... by joeblubaugh on Tuesday March 17, 2026 @07:42PM (#47419868)
In fact it was “the Java way” for many years and “useless getters” was always a big complaint about Java.
Re:Java 26 is here, and with it a solid foundation for the f... by oefrha on Tuesday March 17, 2026 @07:53PM (#47419977)
Hey it's better in Go. In Java it's getFoo(). In Go it's just Foo(). Saves three bytes, and three keystrokes if you program by hand and don't autocomplete!
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:33AM (#47422673)
I do agree to a certain degree, but with getters/setters you could properly hide/set to read-only fields.
Re:Java 26 is here, and with it a solid foundation for the f... by wbl on Tuesday March 17, 2026 @08:24PM (#47420215)
I think you want sum types which admittedly Go doesn't have in a matchable way. However complex error recovery is an anti pattern for Go.
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:31AM (#47422663)
> However complex error recovery is an anti pattern for Go.

Bit of snark from my side, but that's exactly what makes it less good of a fit for "industry purposes".

Go's error handling is possibly the worst out of any "modern" language, it basically copied C's errno which is not something you should have ever done.

Re:Java 26 is here, and with it a solid foundation for the f... by wbl on Wednesday March 18, 2026 @02:50PM (#47429817)
Why exactly do you have complex error analysis happening above a component that has the error? That's anti modular.
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @08:12PM (#47433038)
Because almost my definition you can't handle errors in the component, otherwise you would have a conditional and not an error.

E.g. if I do some IO like "make a copy of these files" and get an error/exception, it's only the caller or maybe even that caller's caller that can properly deal with this condition (e.g. to decide that we will skip the erroneous files or retry).

Re:Java 26 is here, and with it a solid foundation for the f... by peterashford on Thursday March 19, 2026 @03:36AM (#47436078)
This was exactly my experience when I first read about Go. I was so excited until I found they were repeating the c experience of check every bloody return value separately. That was the worst feature of c - why copy it
Re:Java 26 is here, and with it a solid foundation for the f... by dinkumthinkum on Wednesday March 18, 2026 @02:03AM (#47422050)
This is not a dig at Go and this will be controversial but I so struggle to see what problem or area Go is solving outside of CSP. It's a nice language it just feels far too simple and I am really convinced of it as a systems language over Modern C++ and if you want that alternative then we have our rather oxidized friend that seems to more substantial. That's just my take.
Re:Java 26 is here, and with it a solid foundation for the f... by peterashford on Thursday March 19, 2026 @03:47AM (#47436151)
I code Go at work. I've been using it for just over 3 years. I really like it. I prefer Java, but Go is a much more ergonomic C and its a very pragmatic language. Except for the *%!@ error system, that can burn in hell.
Re:Java 26 is here, and with it a solid foundation for the f... by nradov on Tuesday March 17, 2026 @05:26PM (#47418555)
Ya, that seems to be a misunderstanding. "Industry purposes" covers a huge range of stuff. Go is pretty good for systems programming where Java isn't really an option due to the fundamental limits imposed by garbage collection and lack of pointers. Java is pretty good for higher-level application development where occasional GC pauses are tolerable (the GC pauses are rare and fast now, but they still rule out using Java for certain purposes).
Re:Java 26 is here, and with it a solid foundation for the f... by deepsun on Tuesday March 17, 2026 @07:45PM (#47419895)
Are you sure about Go's garbage collector doesn't have pauses? AFAIK they are worse than modern Java's garbage collector [1].

I'm not sure it's even better than Java's, especially for modern ZGC (and you can choose your GC in Java). Definitely less configurable. I would say most of online comments about Java's GC are long outdated.

For example, in web servers a lot of work is request-response, so it's convenient to utilize generational GCs (so that each request data would fit into "young" generation). Similar to arenas, but without code changes. Go's GC is not generational though, so you should care about allocations.

https://codemia.io/blog/path/The-Evolution-of-Garbage-Collec...

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:35AM (#47422692)
Java's GCs (plural) are hands down better.
Re:Java 26 is here, and with it a solid foundation for the f... by Tostino on Wednesday March 18, 2026 @09:15AM (#47425425)
Hell, I even had a use case where serial GC was actually the correct choice (small job runner process that needed to be extremely low memory overhead). It's nice having options, and most of those options are extremely good for the use cases they were designed for.
Re:Java 26 is here, and with it a solid foundation for the f... by Mawr on Wednesday March 18, 2026 @02:16PM (#47429301)
Ok, which one do I choose then, with what configuration? How much time do I need to spend on this research?

How do I verify that they are actually better? Is the overall performance of my program better? Because that's what I care about. I of course do include memory usage in "performance".

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @08:05PM (#47432980)
Do you need extra-low latency, even at very high percentile and are willing to give away a bit of throughput for it? ZGC

At almost every other case: G1 (the default, just don't add any flags).

Do you want to trade off using less memory at the price of some throughput? Decrease heap size, otherwise don't add anything.

That's it, in most cases just use the default.

Re:Java 26 is here, and with it a solid foundation for the f... by Mawr on Wednesday March 18, 2026 @02:13PM (#47429246)
> I would say most of online comments about Java's GC are long outdated.

They are not. Feel free to look up literally any half-decent benchmarks. If Java's on par or better than any other language of note, check the memory usage. It's standard for Java to have 5-20x the memory usage for about the same performance. The memory floor also seems to be in the hundreds of megabytes. Ridiculous.

> For example, in web servers a lot of work is request-response, so it's convenient to utilize generational GCs (so that each request data would fit into "young" generation).

No, that's a job for arenas. Generational GCs are mostly a result of Java's limitations, and not a univerally good approach.

> Go's GC is not generational though, so you should care about allocations.

You should always care about allocations. In fact, the idea that you shouldn't is a big part of Java's poor performance and design.

Re:Java 26 is here, and with it a solid foundation for the f... by peterashford on Thursday March 19, 2026 @03:57AM (#47436221)
No-one ever claimed that Java didn't use a lot of memory. The "comments about Java's GC" used to be about pauses, mainly. Java programmers don't claim that the JVM is conservative with memory use. That said, 5-20x.... nah. Maybe for a toy 'hello world' sized program, but not in real usage
Re:Java 26 is here, and with it a solid foundation for the f... by zokier on Tuesday March 17, 2026 @06:11PM (#47419046)
Go has gc too and arguably worse one than Java
Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Tuesday March 17, 2026 @06:48PM (#47419414)
Yeah but I do like not having to give Go several flags to do something reasonable with its memory
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Tuesday March 17, 2026 @07:17PM (#47419661)
The "reasonable" thing go does is pausing core threads doing the actual work of your program, if it feels they create too much garbage so it can keep up, severely limiting throughput.
Re:Java 26 is here, and with it a solid foundation for the f... by mknyszek on Tuesday March 17, 2026 @08:19PM (#47420164)
I think this is a misunderstanding. If the program out-paces the GC because the GC guessed the trigger point wrong, something has to give.

In Go, what gives is goroutines have to use some of their time slice to assist the GC and pay down their allocations.

In Java, I believe what you used to get was called "concurrent mode failure" which was somewhat notorious, since it would just stop the world to complete the mark phase. I don't know how this has changed. Poking around a little bit it seems like something similar in ZGC is called "allocation failure"?

The GC assist approach adopted by Go was inspired by real-time GC techniques from the literature and in practice it works nicely. It's not perfect of course, but it's worked just fine for lots of programs. From a purely philosophical point of view, I think it results in a more graceful degradation under unexpectedly high allocation pressure than stopping the world, but what happens in practice is much more situational and relies on good heuristics in the implementation.

Re:Java 26 is here, and with it a solid foundation for the f... by adgjlsfhk1 on Tuesday March 17, 2026 @08:36PM (#47420287)
A lot of the answer is that if you can do more work while generating less garbage (lower allocation rate) this problem basically solves itself. Basically every "high performance GC language" other than Java allows for "value type"/"struct"s which allow for way lower allocation rate, which puts a lot less pressure on the GC.
Re:Java 26 is here, and with it a solid foundation for the f... by rossjudson on Tuesday March 17, 2026 @11:56PM (#47421453)
And yet Java outruns pretty much all of them, because it doesn't actually allocate everything on the heap all of the time. And you've been able to declare and work with larger structures in raw memory for ... 20 years? You mostly don't need to, but sometimes you want to win benchmark wars.

And of course it's getting value types now, so it'll win there too. As well as vectors.

Re:Java 26 is here, and with it a solid foundation for the f... by Mawr on Wednesday March 18, 2026 @02:19PM (#47429344)
Post benchmarks. No, ones where you use 20x the memory of Rust to do the same job 1% faster don't count.
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:43AM (#47422762)
How much less allocation rate? Value types are an important thing and fortunately they are coming to Java as well. But they don't decrease allocation rates nearly enough in every kind of software. They may be a necessity in games/certain computations/low-lat trading, but for a typical web server they don't matter all that much - people are using identity having objects in value typed languages the same way here. Especially that with thread local allocation buffers in Java single-use object allocations are not particularly expensive to begin with - live objects are evacuated and then the whole buffer is reset.

So unless you claim that there is no software in Go/C# where the GC is the bottleneck, no, the problem absolutely doesn't solve itself.

Re:Java 26 is here, and with it a solid foundation for the f... by oblio on Tuesday March 17, 2026 @07:00PM (#47419528)
That's a very shallow argument.
Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Tuesday March 17, 2026 @07:14PM (#47419643)
If it were shallow, it'd be easy for them to fix
Re:Java 26 is here, and with it a solid foundation for the f... by oblio on Wednesday March 18, 2026 @03:50AM (#47422822)
Backwards compatibility, every vim and emacs and bash enthusiast should know about it.

It's easy for the USER to fix, since there are flags available. In the day of LLMs it's also easy to find out about those flags and what they do. And if it's so important, testing shouldn't be supremely hard, either.

Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Wednesday March 18, 2026 @11:44PM (#47434660)
Do you mean backwards compatibility for things that rely on the default settings? The defaults have already changed across Java versions and also depend on the system.

Normally when you run a non-Java binary, it uses very little memory to start, doesn't have a limit, and returns memory to the system when it frees things. Supposedly you can set JVM flags to do all that, but performance probably suffers, otherwise they would've just done that. So in practice users are always setting the flags carefully.

Re:Java 26 is here, and with it a solid foundation for the f... by vips7L on Wednesday March 18, 2026 @01:41AM (#47421932)
You don’t have to do that with Java either.
Re:Java 26 is here, and with it a solid foundation for the f... by spullara on Tuesday March 17, 2026 @08:54PM (#47420398)
GC pauses on modern JVMs are < 1ms (ZGC & Shanandoah)
Re:Java 26 is here, and with it a solid foundation for the f... by peterashford on Thursday March 19, 2026 @03:53AM (#47436196)
Go's GC is orders of magnitude behind Java's.
Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Tuesday March 17, 2026 @06:36PM (#47419296)
Exceptions
Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Tuesday March 17, 2026 @10:47PM (#47421049)
Go can't compete with Java bc it's not in the same category as Java.

- Java is a high-level, multi-paradigm programming language

- Go is designed as a systems language to supersede C projects at Google

Now Go identifies as a general purpose language that competes with Java? It's a free country, I guess.

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:34AM (#47422683)
How is Go not high level? What makes it "systems" language? That's just marketing.

It is a language with a fat runtime, running a garbage collector. You just burn it into the binary and call it a day.

Re:Java 26 is here, and with it a solid foundation for the f... by Tostino on Wednesday March 18, 2026 @09:12AM (#47425390)
(just like modern Java can burn its runtime / GC into the binary)
Re:Java 26 is here, and with it a solid foundation for the f... by Mawr on Wednesday March 18, 2026 @02:08PM (#47429169)
No, not just like. You're downplaying significant differences between the two that do in fact matter. So much so in fact, that you're just wrong. Stop spreading misinformation.
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @08:07PM (#47433001)
GraalVM indeed does a lot more than Go, it's a full optimizing compiler while Go does very little optimiations.

But burning a JVM next to a jar file is not hard at all, one could make something like cosmopolitan.

Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Wednesday March 18, 2026 @05:09PM (#47431476)
Go use cases overlap the most with Java. I think the reputation you mentioned comes from Google using a lot of C++ for high-level things others would likely do in Java, so they see Go as a replacement for C++ in some areas. (assuming you meant C++ not C)
Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Wednesday March 18, 2026 @06:52PM (#47432409)
> I think the reputation you mentioned. . .

Actually no. Go was designed from the beginning as a systems language as a C replacement.

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @08:26PM (#47433133)
In what way does that "design" show up in Go, besides marketing?
Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Wednesday March 18, 2026 @09:41PM (#47433731)
It's replete with oddities and limitations that signal "ah, this is because systems language."

Go’s type system, for example, is very much a systems-language artifact. The designers chose structural typing because it was lighter weight, but provided enough type safety to get by. It sucks though for enterprise app development where your team (and your tooling) are desperate for nominal typing clarity and determinism.

Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Wednesday March 18, 2026 @11:46PM (#47434673)
The error handling is like a systems language for sure, I'll agree on that.

But where do Go's docs or founders call it a C replacement? gf000 asked where this is mentioned besides marketing, but I don't see it in the marketing either.

Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Thursday March 19, 2026 @12:38AM (#47435014)
Now that Go is styled as a Java competitor its framing is different. But here's an old golang.org archive for fun:

https://web.archive.org/web/20091113154831/http://golang.org...

The main page title *Go: a systems programming language*

It still sports all the low-level stuff too, pointer arithmetic and all.

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Thursday March 19, 2026 @04:05AM (#47436282)
And a fat runtime with a garbage collector. Like people can write all sorts of programs with a GC, that was never the issue.

But then just stay truthful, otherwise C# is also a system PL.

Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Thursday March 19, 2026 @03:03PM (#47444256)
"Fat" runtime? Go? Nah.

Go's runtime is thin: goroutines, a GC specialized for concurrency, networking, and little else. Java, by contrast, assumes a JVM plus massive stdlibs to handle everything from enterprise apps to big-data, making its platform genuinely "fat" and layered. Other Java-tier languages, C# included, follow the same model.

Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Thursday March 19, 2026 @04:04PM (#47445094)
I agree Go's runtime is as thin as runtimes get. But having a runtime at all disqualifies it from being a C replacement. Rust is trying to replace C, Go is trying to replace Java and some of C++.
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Thursday March 19, 2026 @05:40PM (#47446633)
Even Rust has a runtime. Compared to that Go's is absolutely fat though.
Re:Java 26 is here, and with it a solid foundation for the f... by lucyjojo on Friday March 20, 2026 @07:21PM (#47462170)
java has had profiles for an eternity and multiple jvm implementation. it can get really really thin.

also has modules now.

Re:Java 26 is here, and with it a solid foundation for the f... by zadikian on Thursday March 19, 2026 @02:51PM (#47444067)
Thanks. I'm not surprised they called it a C++ competitor back then. All those systems-style features do make it awkward now that it's targeting the Java-like use cases. No pointer arithmetic, but pointers yeah, and it's not very clear what you're supposed to pass by value vs by ref. You can do things like a DBMS in Go that count as systems programming, but for sure it's not a competitor with C.

Go happened to be attractive for web backends too because it had good greenthreading before Java etc did, and better performance than JS, so it makes sense that they changed the marketing.

Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Tuesday March 17, 2026 @10:51PM (#47421062)
"industry purposes" likely equates to "enterprise software development." And that assertion is 100% correct.