https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

deviant

03/19/2017, 8:37 PM
btw, i've just finished migration
rx -> coroutines
in one of my projects. totally happy so far 🙂
👍 2
k

kingsley

03/19/2017, 8:38 PM
Weldone. That's inspiring. How was the process like? 🙂
I'm currently migrating from Anko's
doAsync/uiThread
style codebase to coroutines
d

deviant

03/19/2017, 8:45 PM
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

kingsley

03/19/2017, 8:48 PM
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

deviant

03/19/2017, 8:57 PM
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

kingsley

03/19/2017, 9:21 PM
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

anthonyeef

03/20/2017, 7:18 AM
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

deviant

03/20/2017, 8:10 AM
1.1.1 and 2.3
k

kingsley

03/20/2017, 11:19 AM
1.1.0 and 2.3
2 Views