Presented at 360|AnDev 2018:
https://360andev.com/sessions/kotlin-coroutines-an-intro-to-practical-use-on-android/
Slightly longer version given at a Meetup is also on Speaker Deck: https://speakerdeck.com/nickcapurso/introduction-to-kotlin-coroutines-for-asynchronous-programming-on-android
Abstract:
Asynchronous programming has always been a challenging problem for Android developers. Any good solution has to gracefully handle errors, cancellation, chaining multiple actions together, handle thread swapping, and much more.
Kotlin’s coroutines are yet another option for asynchronous programming. However, unlike other popular contenders, coroutines meet all the previously mentioned requirements out-of-the-box, have a gentler learning curve, and don’t require you to write an absurd amount of boilerplate.
That said, learning any new asynchronous solution takes time and often comes with a period of trial-and-error until you have all the nuances figured out. Get a jumpstart on coroutines:
(1) Lessen the learning curve by getting the subtleties of coroutines out of the way early
(2) Learn how to work coroutines into an existing app: easy places to start transitioning, interop with existing libraries, and reusing existing threading constructs
(3) Learn how to easily support error handling, cancellation, and task chaining
(4) Learn how to unit test coroutines
Get a head start on coroutines in your apps and easily write, test, and maintain asynchronous code like never before!