Live data from Hacker News

Java 25 officially released

mail.openjdk.org

61–70 of 260 posts

Re: Java 25 officially released

#61

Earlier quoted context omitted.

In the circles I see, Java isn't popular because it's verbose and boring to use. These days I don't see those as significant issues, tbh. I would prefer a Clojure program, but I'll take Java over Typescript at this point.

> it's verbose and boring to use. Python code that follows traditional Python paradigms is called "Pythonic". Java code that follows Java paradigms is called "awful". To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.…

I think a lot of it is the people using it and certain parts of the culture. There are a lot of Enterprise TM programmers that seem to believe as many layers of abstraction and as much verbosity as possible with little tiny methods that do practically nothing leads to better solutions. It is totally possible to write concise and pragmatic code with Java. One thing that will be a thorn in your side though is null handling. The traditional approaches increase line count and branching. The newer(ish) Optional-based null handling is quite verbose but in width.

Re: Java 25 officially released

#62
post #43

recently pulled the trigger on a migration out of jdk8 we decided to bite the bullet and do 21 instead of 17; one of the reasons being 25 being just around the corner. as far as i can tell, the biggest hurdle is 8 to 11 (with the new modules system); but it's smooth sailing from there. the proof-of-concept was done with jdk17, but it worked as-is with jdk21 (except guice which needed a major version bump). (of course…

For us 8 to 17 was tough due to a lot of things you weren’t supposed to be using going away (sun packages). But TONS of libraries did it anyway. And the move from javax to jakarta for a lot of things in there was also tough. If you could get through that, you’re golden. From what I’ve seen going to 21 or 25 look easy. They’re just adding features, the big upheavals of doing the long needed cleanup are over. I expect…

> For us 8 to 17 was tough due to a lot of things you weren’t supposed to be using going away (sun packages). But TONS of libraries did it anyway.

AFAIK, these libraries did so because there was no alternative, and some of the changes in Java 9 and later were done to provide them with an alternative. The only thing left is Signal/SignalHandler, which AFAIK still has no alternative outside the sun.* packages.

Re: Java 25 officially released

#63
post #39

More new programs should be written in Java/on the JVM. Most of the reasons Java dropped out of popularity no longer apply, and at this point it is an incredibly stable and mature ecosystem. I can come back to a Clojure program I wrote ten years ago and it runs great , meanwhile a TypeScript program I write 6 months ago requires a bunch of updating and cleanup.

Java is hugely popular and widely used on large backend systems. I guess a lot of people here don't work on such systems? I'm always surprised when I see comments like the parent, since in my career exposure to Java is near-ubiquitous.

Re: Java 25 officially released

#64
post #6

Damn, still not structured concurrency full release. Really looking forward to that one. Happy to see Scoped Values here though. That'll be big for writing what I'll call "rails-like" things in Java without it just being a big "static final" soup in a god-class, or having a god object passed around everywhere.

I hope structured concurrency ends up feeling better than async/await with less sugar. The examples do not instill confidence, but we shall see.

The structured part is somewhat like using for and while loops rather than goto statements - it uses block scope to make it easier to reason about how concurrent code is compartmentalized.

However, you still have concurrent code. The example given uses futures rather than async/await, and so the thread blocks waiting for these other threads to complete.

The Java alternative to async/await is the virtual threads. Since they are not GC roots and the stack is a chain of heap-allocated objects, the idea is that they can have significantly lower overhead in terms of memory usage for small tasks. Rather than the compiler generating heap objects to store intermediate state, it just uses a virtual thread's stack.

However, even without async/await syntax you still have equivalent concepts. Since the compiler doesn't have native structured concurrency, it is emulated by putting tasks in lambdas. You fork off subtasks, and do a blocking get() to resolve the futures for their results. Heavy use of fork(), run() and get() aren't necessarily better than async and await keywords.

One concern I have is that Java virtual threads are supposedly preemptive, not cooperative. This means you will have less guarantees around concurrent modification than you would with a typical async/await system running cooperatively on an executor. Several languages willing to make more core changes around adding async/await have gone as far as to also integrate actor functionality to help developers write concurrency-safe code. I don't see Java being able to provide developer help/diagnostics here like other languages can.

Re: Java 25 officially released

#65

Earlier quoted context omitted.

In the circles I see, Java isn't popular because it's verbose and boring to use. These days I don't see those as significant issues, tbh. I would prefer a Clojure program, but I'll take Java over Typescript at this point.

> it's verbose and boring to use. Python code that follows traditional Python paradigms is called "Pythonic". Java code that follows Java paradigms is called "awful". To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.…

Those are not Java paradigms per se - they're just practices of mediocre enterprise developers, of which Java has many, owing to being such a mainstream platform.

As for the language itself, a lot of verbosity has been culled in later language versions, with diamond operators, lambda expressions, local variable type inference, etc.

In either case, code is read more than it is written, so if a bit of verbosity makes code easier to read, I'm okay with it.

Re: Java 25 officially released

#66

Earlier quoted context omitted.

In the circles I see, Java isn't popular because it's verbose and boring to use. These days I don't see those as significant issues, tbh. I would prefer a Clojure program, but I'll take Java over Typescript at this point.

> it's verbose and boring to use. Python code that follows traditional Python paradigms is called "Pythonic". Java code that follows Java paradigms is called "awful". To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.…

As someone who has seen awful code in pretty much every language I've worked with, I'd blame this more on inertia and reluctance to change habits. The bad patterns that have entrenched deep into the ecosystem are very hard to shed even when the language and platform is making progress at impressive speed.

Re: Java 25 officially released

#67

Earlier quoted context omitted.

In the circles I see, Java isn't popular because it's verbose and boring to use. These days I don't see those as significant issues, tbh. I would prefer a Clojure program, but I'll take Java over Typescript at this point.

> it's verbose and boring to use. Python code that follows traditional Python paradigms is called "Pythonic". Java code that follows Java paradigms is called "awful". To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.…

ThingDoer.doThing was often just functional programming squeezed into an object-oriented straightjacket. Java 8 added first-class functions and lambdas over a decade ago, eliminating a lot of the need to turn simple behavior into full-blown classes.

Re: Java 25 officially released

#68
post #39

More new programs should be written in Java/on the JVM. Most of the reasons Java dropped out of popularity no longer apply, and at this point it is an incredibly stable and mature ecosystem. I can come back to a Clojure program I wrote ten years ago and it runs great , meanwhile a TypeScript program I write 6 months ago requires a bunch of updating and cleanup.

I think Java is the best language for most medium to large projects or anything that requires threading or complicated/optimized IO

Especially now that hardware architectures are getting fragmented again, I hope it becomes more relevant.

I think Springframework is dragging Java's reputation down. I know Spring boot is better but it's such a monstrosity.

I feel like sadly Python has won the war, though. Good enough for most things even though it is pretty rubbish.

I see people trying to use Rust now for prod AI systems.

Re: Java 25 officially released

#70

Earlier quoted context omitted.

Neat, I wrote some swing apps back in the day that I've thought about resurrecting, but didn't want to have to do much modifying since they are mostly toys, though useful to me. I'm gonna give it a try!

Is Swing good now? Usually when people say Java is good now I assume they're not talking about Swing.

Your neighbor's dog barks at Swing.
Post reply on HN