Kotlin Coroutines Basics

Kotlin is a very popular and modern programing language one of it’s best features is Coroutines. If you are struggling with solving complex programming problems such as asynchronous programming, actors models or lazy evaluated iteration, you should learn Coroutines.


This course will teach you all you need to know about Kotlin Coroutines. Participants will go through the basics, such as the difference between suspend functions and coroutines, as well as advanced topics like structured concurrency, cancellation, and more. 


What You’ll Learn

➜ The purposes and advantages of Coroutines

➜ Effectively leverage all aspects of Coroutines Library

➜ How to use coroutines for asynchronous programming

➜ Coroutines + Retrofit + MVVM

➜ Coroutines and Android Background processing 

 Coroutines flow in an Android app


➜ We recommend that attendees of this course are familiar with Kotlin programming language and Android development. 


Course Outline

Introduction to Coroutine Basics

  • Kotlin Coroutine Fundamentals
  • Coroutines vs. Java Threads
  • Coroutines vs. Stream API
  • Suspending functions 
  • Compilers and their responsibilities 
  • The responsibilities of the library
  • Multiple implementations
  • Bridge functions
  • Sequences, channels and other abstractions
  • Behaviour when limits are met
  • Most used asynchronous patterns


Structured Concurrency with Coroutines

  • Different types within the Coroutines API
  • CoroutineScope and Context
  • Supervisor Scopes
  • Using the standard dispatchers and creating your own
  • Options for sharing mutable state
  • Modeling asynchronous sequences of values as Flows
  • Different operators implemented within Flows
  • Context and termination within Flows


Coroutine Best Practices

  • Ensuring your Coroutine based design is fault tolerant
  • Managing exceptions in Coroutine code
  • Avoiding Deadlock with coroutines
  • Testing and validating coroutines