Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

661–670 of 777 posts

Re: Java 21 makes me like Java again

#661

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…

> Go's major selling point to me is that you can ship one binary, nothing beats that. You can ship one compiled binary in Java too if you want it. https://www.graalvm.org/22.0/reference-manual/native-image/ > Go is simple. It's easy to understand, read, and maintain Go involves a lot of code repetition which makes it difficult to human-scan and maintain. Worked on both large scale Go and Java projects and I found Jav…

> You can ship one compiled binary in Java

Even if you’re shipping a jar. You can ship one artifact by using jlink or you ship the runtime in the docker image.

This has been a solved issue for ages.

Re: Java 21 makes me like Java again

#662

Earlier quoted context omitted.

Isn't it just LGPL? Why is that a "mess"?

I'm not a lawyer, I wish it's as simple as "it's just LGPL", it's not. Otherwise Qt has already conquered the desktop GUI world, it did not for a reason: the license mess.

It did conquer (-ish) the desktop GUI world, for a while: quite a lot of software was written in it.

And then Electron happened.

Re: Java 21 makes me like Java again

#663

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…

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…

Shipping one binary to install on a users machine has been solved by jlink and jpackage for ages.

Re: Java 21 makes me like Java again

#664
post #278

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…

> 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. i think it's a flaw that wasn't considered properly in the standard java toolchain to not produce an embedded java runtime into a final packaged artifact that is self-executable. You end up with third party tooling like: https://www.ej-technologies.com/res…

jpackage and jlink are shipped in the jdk.

Re: Java 21 makes me like Java again

#665
post #615

java was never really a bad language. the people were. if not massive over-engineering. too many abstract concepts that make it hard to grasp a codebase. code voodoo - in the form of reverse GOTO statement i.e annotations DI frameworks . what needs fixing is not the language but the ecosystem. there needs to be a "reformation" movement within the java ecosystem. yeah people migrating to kotlin or clojure or scala isn…

100% agree. You can create a HammerFactoryFactory to churn out HammerFactories in any language. But the ecosystem in Java (and C# is similar imo) promotes and encourages this type of problem solving.

The one thing Java really does need is free standing (or namespaced) functions though. Sometimes I don’t want a class, what’s wrong with a function in a module or namespace in that case?

Re: Java 21 makes me like Java again

#666
post #525

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…

I never see Dart talked about in these contexts but just to highlight a few things. 1. Compiles to native code with a single and very reasonable sized binary on pretty much any platform. 2. Compile to WASM (coming this year) if that’s your thing. 3. Excellent concurrency support with lightweight and simple mental models 4. Variables are not nullable by default thus simplifying tedious checking in your codebase. 5. Sy…

Combining the best parts of Java and JavaScript isn't exactly something to boast about. Dart lives and dies with the Flutter framework. Other than that it's not doing anything special. Not terrible but also not a significant improvement.

Re: Java 21 makes me like Java again

#667
post #665
post #615

java was never really a bad language. the people were. if not massive over-engineering. too many abstract concepts that make it hard to grasp a codebase. code voodoo - in the form of reverse GOTO statement i.e annotations DI frameworks . what needs fixing is not the language but the ecosystem. there needs to be a "reformation" movement within the java ecosystem. yeah people migrating to kotlin or clojure or scala isn…

100% agree. You can create a HammerFactoryFactory to churn out HammerFactories in any language. But the ecosystem in Java (and C# is similar imo) promotes and encourages this type of problem solving. The one thing Java really does need is free standing (or namespaced) functions though. Sometimes I don’t want a class, what’s wrong with a function in a module or namespace in that case?

A class is a module/namespace. You can make a class just to have functions in it.

Re: Java 21 makes me like Java again

#668
post #366

Earlier quoted context omitted.

> 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?

It's not the same. The earliest JVMs weren't really thread safe at all but machines were single core so it didn't matter, you could just cooperatively multi-task. Later HotSpot became thread safe (and fast - a rare achievement), so started using real OS threads so it could go multi-core. Virtual threads are M:N threading. There are multiple native threads so you can exploit all the cores, and also user-space runtime…

> The earliest JVMs weren't really thread safe at all but machines were single core so it didn't matter, you could just cooperatively multi-task.

In the 90s we didn't have multiple cores but we had multiple CPUs. I started using java in '96 on a 2 CPU SPARC and the lack of real thread support was limiting. When green threads was dropped in favor of real (OS) thread support there was much rejoicing. I worked primarily in server performance back in those days.

> Virtual threads are M:N threading.

Solaris had M:N threads early on but it also was dropped.

Re: Java 21 makes me like Java again

#669
post #73

[flagged]

Having worked extensively in Java, Node, and Python, I’ll take the JVM ecosystem absolutely any day of the week. Me and my catheter will be over here delivering actual software while you figure out how React 32 broke your transcompiler.

No idea why you are comparing Java, which is BE, to React, which is FE.

I think I will check Java once they finally make coroutines… I mean “virtual threads” a stable feature. That actually looks exciting… being able to parallelize almost like in Go 5 years ago.

Post reply on HN