Hacker News new | ask | show | jobs
by bsan3 1272 days ago
Java has been improving pretty fast and is starting to close the gap in spots where it's been seen weaker to Go etc. Fact still remains that it has excellent lib ecosystem, tooling, observability and large code bases with multiple teams are much easier managed in static languages. At this point most of the downsides are from legacy frameworks. A modern framework + Kotlin is very productive.
3 comments

Isn't Kotlin slow to compile though? I created a simple hello world Kotlin multiplatform website the other day and it took like 30 seconds to recompile any time I changed anything.
Havent used multi-platform. We use it for Android and Server, seems ok
Really interested what you mean by Java having gaps compared to Golang. You can basically write Golang like code in Java, just leave out any useful language features and you've got it. I have used both professionaly and am not a fan of either. (I really like typed and compiled languages, so those are not my issues with them).
Co-routines .. that's a useful pattern Go did out of the box. Fast startup .. important for containers and auto-scaling

Co-routines have been in Kotlin for a while, got added to Java (Project loom) recently. Same for startup time. Native image support in Project Leyden

For fast startup, look at GraalVM/native-image which compiles Java to native code and works very well.

Downsides are that highly dynamic and reflection-happy Java code bases/libs won't run OOTB, that using profile-guided optimization (for achieving or surpassing HotSpot perfornance levels) requires a commercial EE license from Oracle (about 300-400 bucks per seat last I checked, not required for mere development until used in prod or at customer sites, and bundled with commercial JRE/JDK subscription since about a year), that even with EE your garbage collector choices are limited, and the somewhat overwhelming number of optimization flags to pass to native-image, not unlike earlier JVM runtime arg excesses.

Although note that using PGO with Go isn't really common either. Actually, JVM languages and JS are amongst the very few that use PGO regularly as setting it up and using it with AOT compiled toolchains takes more work.
Java starts very quickly (like a second). If it doesn't, that's typically down to pulling in slow libraries. Spring Boot in particular is awful for start time, can add like 30 seconds to start time.
Coroutines are coming soon, project loom.
Can you list a few modern frameworks? Just curious, I was using Play a few years ago but that was Scala.
Quarkus and Micronaut. Spring replacements almost. Backed by commercial companies and strong dev teams

Super light frameworks, more http focused, Kotor and Javelin

Spring itself had a major overhaul recently