About the Course

Learn about the course's relevant audience, its structure, and see the first example of Kotlin coroutines.

Who is this course for?

In this course, we’ll learn about Kotlin coroutines by focusing on Android and back-end applications. These are currently the two major industry applications of Kotlin, and coroutines were largely designed to suit these use cases. But, while this course is primarily geared toward Android and backend developers, it should be just as useful for other developers who are also using Kotlin.

This course assumes that readers are very familiar with Kotlin and know it well. Beginner learners are encouraged to look at these Educative courses on Kotlin: “The Ultimate Guide to Kotlin Programming” and “Kotlin Crash Course for Programmers.”

Structure of the course

The course is divided into the following parts:

  • Part 1 - Understanding Kotlin Coroutines: Explains Kotlin coroutines and how they really work.

  • Part 2 - Kotlin Coroutines Library: Explains the essential concepts from the kotlinx.coroutines library and how to use them effectively.

  • Part 3 - Channel and Flow: Focused on Channel and Flow from the kotlinx.coroutines library.

What will be covered?

This course is based on a workshop we conducted. During its iterations, we observed what interested attendees and what did not, and these are the elements attendees mentioned wanting to learn about most often:

  • How coroutines really work (Part 1)

  • How to use coroutines in practice (Part 2 and 3)

  • Best practices for coroutines (Part 2 and 3)

  • Testing Kotlin coroutines (Part 2)

  • Flow and how it works (Part 3)

Code conventions

We've used commenting at the end of code snippets or after every line of code to help you understand the results as you play with the code examples. Snippet results are presented using the println() function. The results will sometimes be included at the end of these snippets in comments. If there is a delay between output lines, it will be in brackets.

Let's look at an example.

package kotlinx.coroutines.app
import kotlinx.coroutines.*

suspend fun main(): Unit = coroutineScope {
    println("Hello,") // Hello,
    delay(1000L) // (1 sec)
    println("World!") // World!
}
// Hello,
// (1 sec)
// World!
"Hello World" code in coroutine scope