Reading Coroutine official guide thoroughly — Part 0

Myungpyo Shim
3 min readJan 18, 2019

--

[Korean] English

These days, I think the primary language for Android folks has been changed rapidly from Java to Kotlin. Now, the android official guide shows us their example using two languages. Moreover, StackOverflow which is a life-long friend of all developers frequently answers us using Kotlin language and It’s considered as natural. The same thing has happened in the iOS world.

Personally, I’ve been able to reduce a lot of boilerplates and make my code null-safe in my Java code as using Kotlin. Jetbrain which has developed Kotlin language also invent Coroutine and add it to the stable release of Kotlin.

And I think this will be the most important feature among others in Kotlin. The reason why I think like this is that many of us as developers have gone through difficulty dealing with threading and callback hell. From now on, we can handle multi-threaded logic easier than before and there won’t be callback hell at all.

I’m writing this post to understand coroutine deeply as reading official guide, testing sample code and analyzing the implementation under the hood.

Before getting started…
Below diagram represents the relationship among classes for coroutine. (Jan-2019)

(WTH…?) Don’t be overwhelmed. You will be able to understand the diagram later. I wanted to make it more simple way but I failed.

For now, You can just think CoroutineContext and CoroutineScope as main characters in the coroutine world. And It’s pretty enough. :)

This post simply gives you links of official guide and additional stories about them (I’m going to deep dive into the official guide in this additional section). You are now in Part-0 which has the role of a table of contents.

This is going to be a long journey.

Coroutine

--

--