Kotlin Coroutines: Deep Dive book is finally ready!
A year has passed since I started working on the book Kotlin Coroutines: Deep Dive. When I started writing it, I already had a clear picture of what I wanted to present there, as the book is based on the workshop I am conducting for three years already. I had over 20 editions of this workshop, and with each group, I was improving my explanations and learning what is interesting for developers learning about coroutines. As a fruit of all that work, I am now proud to present the Kotlin Coroutines book.
To be fair, this book was also highly influenced by our technical reviewers. This team includes Nicola Corti (GDE for Kotlin), Garima Jain (GDE in Android), Ilmir Usmanov (working on Kotlin compiler), Sean McQuillan (Developer Advocate at Google), Vsevolod Tolstopyatov (team lead of the Kotlin Libraries team), Igor Wojda (Android Developer Advocate) and others. They all made significant contributions to this book. Along with suggestions for improvements, they pushed my understanding forward and forced me to dig deeper into some topics. Language revision was done by Michael Timberlake. Without all of them, this book would not be as good.
Where can you find this book?
Kotlin Coroutines ebook can be found on LeanPub and paperback can be found on Amazon. You can also find an ebook on Amazon, but the price is higher than on LeanPub, due to Amazon rates.
Why I wrote this book?
I am a happy user of Kotlin Coroutines since its early versions, and I firmly believe that it is a revolutionary solution. However, it is not easy to use coroutines well. I constantly see on a variety of projects, structures that absolutely make no sense (like withContext(SupervisorJob())
, async { ... }.await()
or coroutineScope { launch { ... } }
). I can guess what their authors wanted to achieve, but whoever understands Kotlin Coroutines, can immediately see that the produced code makes no sense. That is why I started teaching Kotlin Coroutines, but soon I realized it is not enough. In over 20 editions of the workshop, I trained over 200 developers, but it is a fraction of all the users. So based on that workshop, I started writing this book. It was supposed to be a simple project, but as always, while writing, I could see more and more topics that need to be explained. Over time, different reviewers joined the project, with amazing suggestions. Applying them all took time, but I am happy with the final result. Finally, my new child is born.
What is this book about?
This is a practical book. It shows everything with examples and focuses on real-life use cases. As this technology is already widely used on Android and backend applications, we will see how we can use it there and what the best practices are.
Who is this book for?
This book is for Kotlin developers who want to understand Kotlin Coroutines and learn to use them in real-life projects in accordance with best practices. The book focuses on backend and Android use cases, but it also presents knowledge that can be used on other platforms.
Why coroutines?
The importance of concurrency is growing, but the classic techniques are not enough. Current trends suggest that coroutines are where our industry is clearly heading, and Kotlin coroutines are a very solid step in the right direction. Let me show them to you, with examples of how well they help in common use cases. I hope you will have a lot of fun reading this book.
Kotlin for developers
This book is a part of Kotlin for Developers series. It is my ultimate series, teaching Kotlin from essentials to advanced topics. Each of its books can be read independently, but together they form a complete picture.
The whole series includes:
- Kotlin Essentials, which covers all the basic Kotlin features.
- Functional Kotlin, which is dedicated to functional Kotlin features, including function types, lambda expressions, collection processing, DSLs, and scope functions.
- Kotlin Coroutines: Deep Dive, which covers all the features of Kotlin Coroutines, including how to use and test them, using flow, best practices, and the most common mistakes.
- Advanced Kotlin, which is dedicated to advanced Kotlin features, including generic variance modifiers, delegation, multiplatform programming, annotation processing, KSP, and compiler plugins.
- Effective Kotlin: Best Practices, which is about the best practices of Kotlin programming.
More about the book on this page.