[`QUESTION`] Hello mates, I always hear people sa...
# coroutines
h
[
QUESTION
] Hello mates, I always hear people saying that RxJava is really powerful and coroutines it's a lighter solution. And they say that the situation to use RxJava is when you should use all those Rx operations (e.g.
transform, map, etc
). Thinking about this I was wondering if it's possible to do the same only with Coroutines and pure Kotlin, and if not, what is it so powerful in Rx?
c
where do people say that?
h
Those who use Rx
I've done things with Rx, but in a legacy project
I was just following the stack and patterns of the project
But in a new project I'm using Coroutines (I'm in love ❤️)
c
its maybe better if you post an example of a powerful rx construct and ask how to do that in coroutines
h
But even when I go to Kotlin events and they talk about Coroutines they say: Look, coroutines are beautiful, but still Rx is more powerful
That's the point @christophsturm 😄 I don't know what is not possible to do with Coroutines.
I never used all those Rx operations
I just made web requests, and ok, maybe transformed some data into another
s
It's both a pro and a con for Rx, but due to its large API, it is more 'powerfull' because it offers more functionality. Before the Flow API in coroutines, Rx was more powerful. But with Flow, it's only the Rx' API surface that gives it its edge.
h
But I could do the same transform with kotlin map function
m
Coroutines is a really flexible construct. I doubt you can find anything in Rx that you just can't do with coroutines.
s
99% of async in Android is one-shot operations. Rx uses Completable, Single or Maybe. Coroutines can just use 'suspend' functions
☝️ 5
h
I always try to say this to people @marstran, but they didn't tried
Flow
😄 as @streetsofboston mension, so they can't understand what Coroutines are able to do now
s
But if your team consists of more than just Android devs (eg iOS), Rx may still be your choice, since its concepts are the same across platforms.
h
Got it
d
well there are certain things that are easier in RX/Reactor but for the most part coroutines are easier to reason about
e.g. afaik there is no built in construct in coroutines that would allow you to conditionally cancel one of the calls (amb operator)
but that is pretty fringe case