Course
Overview
Coroutines are at the heart of asynchronous programming in Kotlin — and yet, their inner workings remain unknown to most of the developers who use them every day.
Understanding what happens under the hood is the difference between concurrent code that works by luck and concurrent code that is truly under control.
This course starts from the language's low-level primitives and works its way up to the kotlinx.coroutines abstractions: contexts, dispatchers, cancellation, structured concurrency, channels, actors, flows… These are all mechanisms you need to know to write asynchronous code that is correct, performant, and testable.
By the end of these two days, you will be able to design, port, and test idiomatic concurrent code in Kotlin, and choose the right tool for each problem.
Program
Objectives
Understand the inner workings of coroutines and leverage their low-level primitives.
Master structured concurrency, scopes, and cancellation handling.
Port synchronous or thread-based APIs to coroutines.
Communicate between coroutines with channels and the actor model.
Use hot and cold flows, their operators, and how to share them.
Effectively test coroutine-based code.
Prerequisites
Solid command of Kotlin and application development experience. Some prior use of coroutines (suspend, launch, async) is recommended.
Program
D1
From primitives to structured concurrency
Morning
Synchronous coroutines
sequences and generators, without concurrency
Low-level primitives
Continuation, suspendCoroutine, createCoroutine
Coroutine contexts
customize coroutine behavior
The thread-hopping problem
understand it and fix it manually
Afternoon
Concurrency & parallelism
execution models and event loops
Cancellation
cleanly interrupt ongoing work
API porting
adapt synchronous and thread-based APIs
Scopes
structure and compose concurrency
D2
Channels, flows & tests
Morning
Dispatchers
distribute work across domains
Channels
communicate between coroutines
Actor programming
principles and implementation
Hot & cold flows
understand their differences
Afternoon
Flow sharing
share and broadcast a flow
Operators
transform, combine, and filter flows
Flow dispatching
control the execution context
Tests
test coroutine-based code
Details
- Format
In-company
- Duration
2 days (14 hrs)
- Level
Expert
These trainings might interest you
Our workshops are designed for professionals. Each program is tailored to your team's level and context, whether in-house or as an open session.
Kotlin Multiplatform: Mobile
Share your business logic between Android and iOS without sacrificing the native experience: master the Kotlin Multiplatform toolchain and Swift interoperability to design, distribute, and integrate a robust shared SDK that accelerates your teams.
The Kotlin Language: Concepts & Tools
Discover how Kotlin lets you write less code with fewer errors: its key concepts and tools will quickly make you productive at building safe, readable, and maintainable applications.
Compose: Interfaces in All Their Forms
Embrace declarative thinking to build reactive, maintainable, and performant interfaces. Master state and data flow to share a single UI codebase across Android, iOS, Desktop, and Web.
The Kotlin Language: Expertise for Deploying APIs
Go beyond everyday Kotlin: understand the deep mechanisms of the language and compiler to write idiomatic, safe code, design durable public APIs, and automate code generation.
Koog: Integrating AI into Your Multiplatform Apps
Go beyond the simple LLM call: use Koog to design AI agents integrated into your Kotlin applications, capable of acting and orchestrating themselves, reliable, cost-efficient, and observable in production.
Gradle: Master & Optimize Your Builds
Finally understand what happens in your Gradle builds to make them reliable, fast, and maintainable: factor out your configuration, automate your specific needs, and save precious time on every build.