Is anyone using kotlin coroutines as a replacement...
# android
s
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
@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
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
i've abandoned rxjava few months ago. feel totally ok with coroutines
l
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
@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
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
debouncing can be implemented by few lines of code with coroutines though
1
k
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
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