Hey guys! I'm wondering what the advantages of using coroutines over RxJava.
l
louiscad
03/23/2018, 1:53 PM
Smaller & more intuitive. Learning curve is way steeper for RxJava
j
Jonathan
03/23/2018, 2:29 PM
Produced code is IMO clearer and easier to reason about. And coroutines use kotlin generics allowing easier and safer management of variance an nullable types, (Observable generics have platform type)
d
deviant
03/23/2018, 2:40 PM
i like the syntax. all those chains of `flatMap`s is a hell
👍 2
d
Dmytro Danylyk
03/25/2018, 9:28 PM
Here are few benefits of channels over rx (IMO):
* Can handle null emissions (and in a safe way, thanks to Kotlin type system)
* Threading is explicit. With Rx, it's often hard to know on what thread pool each piece of code is executed
* ReceiveChannel and SendChannel use on-site variance which can make thinks easier when generic variance is involved.
* It is (a lot) easier to create custom operators with channels.
* When it comes to parallelism, Coroutines are (IMO) way easier to use and produce clearer code.
* pipeline pattern out of the box.
So far, I haven't run in a use case that Rx solved and I couldn't handle in a nice and easy way with Channels. If you know one, i would be interested to look at it.