https://kotlinlang.org logo
#android
Title
# android
s

spierce7

03/03/2018, 4:46 PM
Is anyone using kotlin coroutines as a replacement for rxjava? I'm starting a new project, and am considering coroutines in place of rxjava. I'm wondering what peoples thoughts are around this.
l

louiscad

03/03/2018, 5:01 PM
@spierce7 I love coroutines. So simple and so powerful at the same time. I'd recommend them anytime they suit your needs, and I know they suit many needs Android apps have. Also, they are lighter than RxJava in multiple ways (jar & dex size, methods count, learning curve, readability…)
k

Konstantin

03/03/2018, 7:44 PM
If you don't have complex flow than coroutines rocks, but when you already heavily rely on rxjava I see no point using them together.
d

deviant

03/03/2018, 7:47 PM
i've abandoned rxjava few months ago. feel totally ok with coroutines
l

little

03/04/2018, 8:18 PM
Aren't they experimental at the moment? I like them a lot but I am afraid if anything breaks at any future version. I would be shaking at any future update.
l

louiscad

03/04/2018, 8:31 PM
@little They are under an experimental status indeed, but from what the Kotlin team said, we shouldn't expect a shaky migration, and if needed, they will provide tools for migration. Given the advantages of coroutines over anything else available in Kotlin, it's worth the future migration.
k

kenkyee

03/05/2018, 2:15 PM
Some things rxjava does better (e.g., debouncing UI changes and working with multiple fields changing to do one thing) and some things coroutines do better (more easily understandable async code)
d

deviant

03/05/2018, 2:18 PM
debouncing can be implemented by few lines of code with coroutines though
1
k

kenkyee

03/05/2018, 7:56 PM
it's one operation w/ rxjava (.throttleFirst() or debounce())...not even a line of code. And doing combineLatest to do field validation on a set of fields in Java is simpler.
s

spierce7

03/06/2018, 5:42 AM
Yeah, it feels like all of those operators are easy to create though with extension functions, and whats even more though is I can create my own custom operators, and not have them be absolutely insane to understand as they currently are
6 Views