likeabbas 8 days ago

Java 21 is pretty damn nice, 25 will be even nicer.

For your own application code, you don't have to use exceptions you can write custom Result objects and force callers to pattern match on the types (and you can always wrap library/std exceptions in that result type).

Structured Concurrency looks like a banger of a feature - it's what CompletableFuture should've been.

VirtualThreads still needs a few more years for most production cases imo, but once it's there, I truly don't see a point to choose Go over Java for backend web services.

2
fpoling 8 days ago

And Java has non-trivial advantage over Go of being arch-independent. So one can just run and debug on Mac Arm the same deployment artifact that runs on x86 server.

Plus these days Java GC has addressed most of the problems that plagued Java on backend for years. The memory usage is still higher than with Go simply because more dynamic allocations happens due to the nature of the language, but GC pauses are no longer a significant problem. And if they do, switching to Go would not help. One needs non-GC language then.

synergy20 8 days ago

go can ship as a static exe, can't be simpler to deploy, until java has this built-in, I'll stick with go for my cross platform choice

likeabbas 7 days ago

If you're building tools that need to be deployed to machines, Go/Rust with their static binaries make a lot of sense. But for backend web services, it's hard not to go with Java imo.

fwiw - My favorite language is Rust, but Async Rust has ruined it for me.

pdimitar 6 days ago

Yeah, async Rust is needlessly difficult. I can't quite put my finger on it but having to sift through 10+ crates docs definitely left a very sour taste when I had to modernize one tokio 0.1 app to a 1.x one.

I do love Rust a lot as well but most of the time I am finding myself using either Elixir or Golang.

t-writescode 8 days ago

And if you want even cleaner and simpler syntax, while getting the benefits of the JVM, then Kotlin is a nice "step up" from there!

likeabbas 7 days ago

My company is trying to force Kotlin as the default, but I just prefer modern Java tbh. Kotlin is a very nice language, and I'd be fine with writing it, but modern Java just seems like it has "caught up" and even surpassed Kotlin in some features lately.

Tainnor 7 days ago

YMMV, but null safety alone for me is a reason never to use Java when I could use Kotlin instead.

likeabbas 6 days ago

null safety is very nice. But @Nullable and @NotNull annotations have worked very well for me so far.