btw, i've just finished migration `rx -> corout...
# coroutines
d
btw, i've just finished migration
rx -> coroutines
in one of my projects. totally happy so far 🙂
👍 2
k
Weldone. That's inspiring. How was the process like? 🙂
I'm currently migrating from Anko's
doAsync/uiThread
style codebase to coroutines
d
How was the process like?
most of the rx features can be replaced by coroutines + simple imperative code (what i really like) migrated retrofit calls, firebase callbacks, few heavy calculation tasks, various timers/delays, android lifecycle tricks (rxlifecycle)
k
Cool stuff. Were there any particular difficulties encountered in the process? Given you are already using Rx, did you at any time feel the migration might not be worth it?
d
well. i love rxjava too. this and kotlin are probably most exciting things that happend in android development last years. but coroutines allow you to write more readable code. rx code can be really messy sometimes (
flatMap
hell). so far i've expected some problems with debugging. you never knows how much coroutines are running, why it stuck and so on. and the main problem: sometimes i get wrongly builded app, so it crashes with weird dex class not found errors. and sometimes there are no errors but none of coroutine works (i call it "stuck"). then i just
clean
project and all problems have gone. still investigating, can't reproduce it by 100%
👍 3
i suspect there is something wrong with kotlin incremental compilation
k
Okay. Thanks for the explanation. I also agree that Rx can sometimes get messy and overwhelming, given the different operators and all that. Asides the valid debugging support you raised, I'm yet to see any problems arise with coroutines so far. One, not high priority thing I'd be happy to see is a way to cancel child jobs without necessarily cancelling the parent itself, something like `CompositeDisposable`'s
clear
and
cancel
a
I tried coroutines last time when Kotlin 1.1 release with Android but failed. Which version of Kotlin and Android studio are you using?
d
1.1.1 and 2.3
k
1.1.0 and 2.3