r/Backend • • 19d ago

Java 25 (with virtual threads) for a startup

Are you working in a startup company that chose Java 25 as a backend language?

What is your impression regarding developer experience, performance and easiness build things fast?

39 Upvotes

37 comments sorted by

View all comments

11

u/macabre_brotherhood 19d ago

The following are good times to NOT use Java:
* GUI / desktop apps
* Short-lived processes where startup latencies matter, like CLIs or Lambda functions
* Memory restricted environments where you require tight control over allocation
* Real-time applications where a garbage collector would negatively impact timing
* Unresolved trauma from the classloader or generic type erasure implementation

If none of those apply to you and your team, it's a perfectly cromulent language. Widely used, widely trusted, blah blah blah. Very mature. Hard to go wrong.

11

u/woj-tek 19d ago

GUI / desktop apps

Hmm... while it's somewhat true that "Java lost the desktop" I'd argue you could create quite nice desktop/GUI apps with either Swing or JavaFX (heck, IntelliJ is written in Java!) or even use Qt bridge (Jambi: https://wiki.qt.io/Qt_Jambi). The result wouldn't be all that much "heavier" than electron 💩 we are forced to use nowadays...

5

u/starbuxman 19d ago

Javafx + Spring Boot + GraalVm is pretty amazing

It’s infinitely more performant than electron

And you can trust the type system, which is nice

https://youtu.be/Od2NDwHED58?is=wVs7uHMn2R1hKy13

1

u/lazystone 18d ago

I did some prototyping with Avaje Inject and JavaFX and it works.

Avaje Inject is compile time weaving and very lightweight(especially comparing to SB), so startup time is minimal.

0

u/macabre_brotherhood 19d ago

True, I've seen good UIs. Let me put it this way, as a user, I can usually tell when it's Java. It lags in weird ways. It's clunky. The memory usage is pretty rough. And so for me, I look for more native experiences - at least when there's feature parity. If the only thing out there is a Java desktop app, and it does something uniquely useful, I'll use it.

1

u/th3_pund1t 19d ago

It lags in weird ways. It's clunky.

Typically, this is a result of someone performing IO or heavy compute in the render thread.

You can have the same problem in many other UI frameworks.

Bad UIs are not unique to Java Desktop. I've seen bad UIs with iOS, Android, Electron, etc.

2

u/macabre_brotherhood 19d ago

Could be that, but it also could be the JIT compiler cold-loading some hitherto-unused section of the code. Could be the GC. Could be the developer being bad at shared state. Could be a lot of things. And the effort involved in finding out the answer to that question, is juuust high enough, that many Java devs will simply not do this portion, and call the lags "good enough"

1

u/woj-tek 18d ago

Hmm... Don't have that much experience with Java desktop apps (dying bread) so can't compare that well. And comparing to IDEA is problematic because it's gigantic...

Alas, I do agree with some issues: other solutions have more "native" integrations (with the rest of the system like tray or dock) and are generally better at "faking" looking native-ish. It's a result of years of huge neglect while the rest of the gang sprinted past java…

10

u/za3faran_tea 19d ago edited 19d ago

Real-time applications where a garbage collector would negatively impact timing

Unless its hard real-time, you may very well be able to use ZGC as it gives you sub-ms pause times. Even then, Java has been used for real time systems before ZGC (but it generally uses a different paradigm of programming than traditional backend systems).

3

u/vips7L 19d ago

You'll likely get the same length pauses from OS kernel traps as ZGC. It's effectively pauseless.

1

u/macabre_brotherhood 19d ago

Yeah I mean "each clock cycle matters" level of real-time. All I'm saying is use the right tool for the job. But yes you're also right about ZGC.

1

u/aoeudhtns 18d ago

I'm using generational ZGC for a near-realtime service and it's working exceptionally well.

0

u/petros211 18d ago

Mfkers will do anything to not use a real systems language

3

u/java_dev_throwaway 19d ago

unresolved trauma from the class loader lmao, that's some real shit

1

u/Competitive_Cry3795 18d ago

"Unresolved trauma" lol

1

u/whizzter 18d ago

"Nobody got fired for chosing Java"

1

u/strat-run 13d ago

With ZGC and MemorySegments and everything you can do off heap the has never been a better time to create Java applications that can't handle gc pauses or need control over allocation.

Start is better now, especially with AOT caching.

GUIs are still an issue.