Kotlin is a fantastic modern language with many killer features, but one of the best is Coroutines. Coroutines, as implemented in Kotlin, are an elegant way of solving many complex programming problems including asynchronous programming, actors models, lazy evaluated iteration and more.
In this course you'll gain a complete understanding of Kotlin Coroutines. We'll cover both the fundamentals, such as the difference between suspend functions and coroutines, and delve into many of the advanced features such as structured concurrency, cancellation and more.
- What precisely is a Kotlin Coroutine?
- Comparing Coroutines to Java Threads
- Comparing Coroutines to the Stream API
- How does a suspending function work?
- The responsibilities of the compiler
- The responsibilities of the library
- Potential for multiple implementations
- Choosing and using bridge functions
- Sequences, channels and other abstractions
- Behaviour when limits are met
- Commonly applied asynchronous patterns
Structured Concurrency with Coroutines
- A tour of the types within the Coroutines API
- The importance of the CoroutineScope and Context
- Defining Supervisor Scopes
- Using the standard dispatchers and creating your own
- Options (including actors) for sharing mutable state
- Modelling asynchronous sequences of values as Flows
- How different operators are implemented within Flows
- Understanding 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
All delegates should be familiar with the fundamentals of programming in Kotlin.