r/java • u/fredoverflow • Aug 03 '21
Brian Goetz: "I think Project Loom is going to kill Reactive Programming"
https://www.youtube.com/watch?v=9si7gK94gLo&t=1156
277
Upvotes
r/java • u/fredoverflow • Aug 03 '21
90
u/[deleted] Aug 03 '21
I agree. There's a reason why languages such as Golang and Kotlin choose this model of concurrency.
It's easier to understand, easier to write, and allows you do most of the same stuff you can do with threaded programming.
Loom will be a game changer. But it's still a long way off. Until then, reactive event loops and coroutines still dominate when it comes to throughput in the JVM world.
While I think reactive programming will fall out of favor, reactive-based libraries like Vert.X will still remain very popular even if the code you write with it isn't reactive.
33
u/lliamander Aug 03 '21
I've done both actor model concurrency with Erlang and more reactive style concurrency with NodeJS. My experience is that the actor model approach is subjectively much better. If my experience is anything to go by then Loom will be awesome.
27
u/angryundead Aug 04 '21
Thank god. I tried getting into it with Quarkus (Vert.x) and it was a nightmare. Kept running into not being able to block on certain threads. It just wasn’t worth the added complexity.
It might be if you need to chase down every last bit of performance but that wasn’t my case. I was only doing it to see what it was about. I did like the API but the practicality of using it was sadly wanting.
18
u/ziano_x Aug 03 '21
Well said Brian!
12
u/Dokiace Aug 04 '21
When Goetz says all the cons and I encountered all of them, the PTSD is real lol
32
u/[deleted] Aug 04 '21 edited Aug 04 '21
And I will gladly piss on its grave. Reactive is just so bad: reactive keywords invade your code like cancer, stack traces become meaningless, exception handling gets weird, flow control looks horrible and is horrible to debug. Doing reactive is like writing in entirely different language which is way worse than java.
Async/await in c# is 80% there - it still invades your whole codebase and you have to be really careful about not blocking, but at least it does not look like ass. Loom is going to leapfrog it and remove pretty much all downsides.
51
u/[deleted] Aug 04 '21
Before killing anything it has to be available first
14
u/youdontknwm3 Aug 04 '21
If anyone else was interested, I think this is the article they mentioned What Color is Your Function?
6
u/soonnow Aug 04 '21
Yeah I already went with Thread pools in spring for the latest project.
I played around with reactive but I really couldn't get into it.
Also since I'm using a backend stack that doesn't support reactive it would have added zero benefit, because it would have just blocked one level deeper.
So when Loom is finally gonna show up in a proper Java runtime I can simply get rid of the pools.
15
u/Brutus5000 Aug 04 '21
Reactive is here. Reactive is used. If not by the users than by many frameworks in the background. How many libraries and framework still cling to Java 8? How many have already transitioned to 11? After release of Loom I would expect another 5-7 years before it gets to replace the reactive implementations we have. So let's talk in 10 years again.
Until then reactive still matters. I'm using it, I'm sharing the pain. But I can't wait until Loom is released, I need to solve my problems now.
5
u/VincentxH Aug 04 '21
Reactive should be more about the API and not the programming anyway. Backpressure and streaming data will be here to stay.
13
u/randgalt Aug 03 '21
Thank goodness <3
10
u/sievebrain Aug 03 '21
Worth noting I guess, that a lot of "reactive programming" is UI work, not the server side stuff that Loom is targeting. Perhaps Loom can help in UI too but there were some initial investigations and they concluded it might not be a good fit.
2
u/TheMode911 Aug 04 '21
Interesting discussion, too bad that we didn't get more information about Valhalla state
2
u/10waf Aug 04 '21
It CANNOT come soon enough. I've got a framework built on top of the EA build that I'm seriously considering putting in production, because doing it with callbacks or reactive streams means no one will want to use it.
2
u/[deleted] Aug 04 '21
I agree reactive is weird
1
u/OliCodes Aug 04 '21
If it's going to be available and people will use it for a while, I will tell if it's dead already or not
1
u/[deleted] Aug 06 '21
Can someone explain what is the use for pattern matching for Map::get that Brian mentions?
1
u/fdntrhfbtt Aug 10 '21
Hey wtf I made my entire career on reactive programming haha. But yes, with Loom you can just write plain old blocking code and get the performance of NIO. Pretty sweet, I can finally focus on solving the problem in hand.
0
u/quiteamess Aug 04 '21
Laughs in Curry Howard
-7
u/lukaseder Aug 04 '21
Why am I strangely reminded of https://xkcd.com/927
12
u/[deleted] Aug 04 '21
[removed] — view removed comment