Practical Kotlin Deep Dive

Practical Kotlin Deep Dive unpacks the "how" and "why" behind Kotlin from core language fundamentals and internal mechanisms to the design of its APIs. It spans Kotlin basics, the standard library, coroutines, kotlinx libraries, compiler internals, and Kotlin Multiplatform.

This book goes beyond surface-level APIs by diving into Kotlin's internals: it walks through real Kotlin function implementations, demystifies generated bytecode, and explains how the Kotlin compiler interprets the language. It also draws directly from KEEP proposals, JetBrains YouTrack discussions, and compiler source code to connect concepts to their origins and design rationale.

Practical Kotlin Deep Dive Book Cover
480
PDF Pages
5
Chapters
70
Deep-Dive Topics
50+
Pro Tips

Paperback and hardcover editions are being prepared on Amazon

Jaewoong Eum (skydoves)

Google Developer Expert for Android and Firebase

This is Jaewoong Eum (also known as skydoves), a Google Developer Expert (GDE) for Android and Firebase, and previously Kotlin GDE. I've created over 80 open source libraries and projects, which collectively achieve more than 15 million downloads annually by developers worldwide. I'm also the founder of Dove Letter, a subscription based repository where I share, explore, and discuss topics around Android, Jetpack Compose, and Kotlin.

This is my second book, following Manifest Android Interview, which has been very successful and well-received by the Android developer community worldwide.

I hope this book helps you gain new perspectives, sharpen your problem solving skills, and build a comprehensive understanding of Kotlin, from the language fundamentals to advanced topics like coroutines, the compiler, and multiplatform development. Learning should always be an ongoing journey, and every challenge you overcome makes you a better engineer.

As always, happy coding, and best of luck on your Kotlin journey!

Proudly Supported By

Everything You Need to Master Kotlin

Deep dive into Kotlin fundamentals and become a better Kotlin developer

๐Ÿ“–

In-Depth Explanations

Each topic provides detailed explanations that go beyond surface-level knowledge, exploring not just how Kotlin features work but why they were designed that way. You'll understand the reasoning behind design decisions and trade-offs.

๐Ÿ’ก

Pro Tips for Mastery

The "Pro Tips for Mastery" sections dive deeper into advanced topics, uncovering internal structures of the Kotlin fundamentals, and offering expert insights that you can apply immediately to write better code.

๐Ÿ”

References to Source Code

You'll find references to KEEP (Kotlin Evolution and Enhancement Process) proposals, JetBrains YouTrack discussions, and compiler source code, giving you direct insight into the design decisions behind the language.

๐Ÿ“š

Comprehensive Coverage

From Language Fundamentals to Standard Library, Coroutines, Compiler and Plugins, and Kotlin Multiplatform - this book covers practical knowledge that makes a real difference in how you write, debug, and optimize Kotlin code.

What This Book Covers

Five comprehensive chapters covering all aspects of Kotlin development

Chapter 0

24 Topics

Kotlin Language

Covers the fundamental building blocks of Kotlin, from null safety and type system design to advanced features like sealed classes, inline functions, and delegation. You'll explore the language's design philosophy by referencing KEEP proposals and discussions from Kotlin language engineers.

Chapter 1

7 Topics

Kotlin Standard Library

Dives into Kotlin's rich standard library, exploring collections, sequences, scope functions, and the utilities that make Kotlin code expressive and concise. Understanding these tools is essential for writing idiomatic Kotlin code.

Chapter 2

19 Topics

Coroutines

Provides an extensive exploration of Kotlin's approach to asynchronous programming. From basic concepts like suspending functions and coroutine builders to advanced topics like structured concurrency, Flow, and exception handling.

Chapter 3

4 Topics

KotlinX Libraries

Explores the official Kotlin libraries developed by JetBrains that extend the language with additional functionality. These libraries provide specialized capabilities for serialization, date/time handling, and immutable collections.

Chapter 4

7 Topics

Kotlin Compiler and Plugins

Takes you behind the scenes of how Kotlin code becomes executable programs. You'll learn about the compiler's architecture, the K2 compiler and its improvements, FIR, IR, and how to create compiler plugins.

Chapter 5

9 Topics

Kotlin Multiplatform

Explores Kotlin's cross-platform capabilities, covering project structure, source set hierarchies, platform interoperability, and Compose Multiplatform for shared UI development. As multiplatform adoption grows, this knowledge becomes increasingly valuable.

What Developers Are Saying

"Since Kotlin was designated as the official language for Android development, it has been loved by many developers. Today, it has grown beyond Android and continues to prove its potential across a wide range of platforms.

In real-world Kotlin development, you inevitably run into all kinds of issues. As you work through them, you naturally start peeking under the hood, and many of us end up wanting to understand Kotlin more deeply.

This book is written for exactly those developers. It takes a deep dive into Kotlin's core principles and internal mechanisms. If you're a Kotlin developer who wants to truly understand the language and expand your technical spectrum to the next level, I highly recommend giving this book a read."

Sungyong An

Sungyong An

Senior Android Engineer @ Naver Webtoon

Google Developer Expert for Android

@fornewid
Original text

Kotlin์€ ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœ์˜ ๊ณต์‹ ์–ธ์–ด๋กœ ์ง€์ •๋˜๋ฉด์„œ ๋งŽ์€ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์‚ฌ๋ž‘๋ฐ›๊ธฐ ์‹œ์ž‘ํ–ˆ๊ณ , ์ง€๊ธˆ์€ ์•ˆ๋“œ๋กœ์ด๋“œ๋ฅผ ๋„˜์–ด ๋‹ค์–‘ํ•œ ํ”Œ๋žซํผ์œผ๋กœ ๋ป—์–ด๋‚˜๊ฐ€๋ฉฐ ๊ทธ ๊ฐ€๋Šฅ์„ฑ์„ ๋ณด์—ฌ์ฃผ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

์‹ค๋ฌด์—์„œ Kotlin์„ ์‚ฌ์šฉํ•˜๋‹ค ๋ณด๋ฉด ํ•„์—ฐ์ ์œผ๋กœ ๋‹ค์–‘ํ•œ ์ด์Šˆ๋ฅผ ๋งˆ์ฃผํ•˜๊ฒŒ ๋˜๊ณ , ๋งŽ์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ์ด ๊ณผ์ •์—์„œ ์ด์Šˆ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉฐ ๋‚ด๋ถ€๋ฅผ ์กฐ๊ธˆ์”ฉ ๋“ค์—ฌ๋‹ค๋ณด๊ฒŒ ๋˜๊ณ , Kotlin์„ ๋” ๊นŠ์ด ์ดํ•ดํ•˜๊ณ  ์‹ถ๋‹ค๋Š” ๊ฐˆ์ฆ์„ ๋А๊ปด์™”์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ด ์ฑ…์€ ๋ฐ”๋กœ ๊ทธ๋Ÿฐ ๋ถ„๋“ค์„ ์œ„ํ•ด Kotlin์˜ ๊ทผ๋ณธ ์›๋ฆฌ์™€ ๋‚ด๋ถ€ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ์‹ฌ๋„ ์žˆ๊ฒŒ ํƒ๊ตฌํ•ฉ๋‹ˆ๋‹ค. Kotlin์˜ ๊นŠ์ด๋ฅผ ์ดํ•ดํ•˜๊ณ  ๊ธฐ์ˆ  ์ŠคํŽ™ํŠธ๋Ÿผ์„ ํ•œ ๋‹จ๊ณ„ ๋” ๋„“ํžˆ๊ณ ์ž ํ•˜๋Š” Kotlin ๊ฐœ๋ฐœ์ž๋ผ๋ฉด ๊ผญ ์ฝ์–ด๋ณด์‹œ๊ธฐ๋ฅผ ์ ๊ทน ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค.

"Practical Kotlin Deep Dive is an exceptionally comprehensive guide that goes beyond syntax to explore the internal mechanisms and design philosophy of the Kotlin language. Jaewoong also provides practical, battle-tested advice based on his extensive experience as a Google Developer Expert and prolific open-source contributor."

John O'Reilly

John O'Reilly

Staff Software Engineer @ Kraken Technologies

Google Developer Expert for Android

Bluesky

"Practical Kotlin Deep Dive by Jaewoong is exceptionally well written, breaking down complex concepts into clear, approachable explanations. It was a truly great read, offering both depth and clarity in a way few technical books achieve today. In an era where tools like Copilot make writing technical content more challenging and competitive, this book stands out and is worth every cent."

Madona S. Wambua

Madona S. Wambua

Engineering Leader & Author

Google Developer Expert for Android

LinkedIn

Table of Contents

Chapter 0: Kotlin Language

  • Q) 0. Explain the null safety in Kotlin
  • Q) 1. What are the primary roles of Any, Unit, and Nothing?
  • Q) 2. What is a data class, and how does it differ from a regular class?
  • Q) 3. What is a sealed class and explain the use cases
  • Q) 4. What is an inner class and what are the differences from a nested class?
  • Q) 5. When do you use an enum class?
  • Q) 6. What is a value class?
  • Q) 7. What is an object and what are the differences from a regular class?
  • Q) 8. What is a companion object?
  • Q) 9. What are the differences between var and val?
  • Q) 10. What are the differences between backing fields and backing properties?
  • Q) 11. What's a delegated property?
  • Q) 12. What are the differences between the lazy delegate and lateinit?
  • Q) 13. What visibility modifiers exist?
  • Q) 14. When is the init block invoked, and what are its key characteristics?
  • Q) 15. What is the higher-order function, and what advantages can you take?
  • Q) 16. What are the benefits and limitations of an inline keyword?
  • Q) 17. What's a reified keyword, and what are the benefits of using it?
  • Q) 18. How do you use a lambda expression?
  • Q) 19. What is functional (SAM) interfaces?
  • Q) 20. What's extension, and what are its pros and cons?
  • Q) 21. What are structural equality and referential equality?
  • Q) 22. What happens when you run null + null operation?
  • Q) 23. What is DSL and how can it be utilized?

Chapter 1: Kotlin Standard Library

  • Q) 24. What are the collection types exist in Kotlin?
  • Q) 25. What types of transformation operators are available for collections?
  • Q) 26. Explain the mechanisms of Iterators
  • Q) 27. What is a Sequence and its mechanism?
  • Q) 28. What types of extension functions are available for retrieving parts of a collection?
  • Q) 29. How do you define the ordering of objects?
  • Q) 30. What are the scope functions?

Chapter 2: Coroutines

  • Q) 31. What are Coroutines?
  • Q) 32. What is a Continuation, and how is it related to a suspend function internally?
  • Q) 33. What are the differences between coroutines and threads?
  • Q) 34. What are coroutine builders?
  • Q) 35. What is a coroutine context?
  • Q) 36. What is the role of a Job?
  • Q) 37. What is the purpose of a coroutine scope?
  • Q) 38. What kind of coroutine dispatchers exist, and what's their purpose?
  • Q) 39. What are channels and how they works?
  • Q) 40. What are the join() and yield() functions?
  • Q) 41. How do you handle exceptions in coroutines?
  • Q) 42. What are the differences between cold flow and hot flow?
  • Q) 43. Explain the differences between StateFlow and SharedFlow
  • Q) 44. What does the Flow.flowOn() operator do?
  • Q) 45. How Flow.buffer() operator works?
  • Q) 46. How Kotlin's internal mechanisms optimize Flow with FusibleFlow and ChannelFlow
  • Q) 47. What are the differences between launchIn(Scope) and Scope.launch()?
  • Q) 48. What are Flow transformation operators: flatMapLatest, flatMapMerge, flatMapConcat?
  • Q) 49. What are callbackFlow and channelFlow, and their internal mechanisms?

Chapter 3: KotlinX Libraries

  • Q) 50. What is kotlinx-serialization and how does it work?
  • Q) 51. What is kotlinx-datetime and why use it over Java time APIs?
  • Q) 52. What is kotlinx-collections-immutable and when should you use it?
  • Q) 53. What other notable KotlinX libraries exist?

Chapter 4: Kotlin Compiler and Plugins

  • Q) 54. What are the annotation processor, KAPT, and KSP?
  • Q) 55. What is the structure of the Kotlin Compiler?
  • Q) 56. What is the K2 compiler?
  • Q) 57. What is FIR (Frontend Intermediate Representation)?
  • Q) 58. What is IR and how does the Kotlin backend work?
  • Q) 59. How do you write a Kotlin Compiler Plugin?
  • Q) 60. What are some real-world Kotlin compiler plugin examples and use cases?

Chapter 5: Kotlin Multiplatform

  • Q) 61. What is Kotlin Multiplatform?
  • Q) 62. How does Kotlin Multiplatform handle platform-specific APIs and share the common codes?
  • Q) 63. What strategies are available for concurrency or asynchronous programming in KMP?
  • Q) 64. What strategies are available for HTTP network communication in KMP?
  • Q) 65. What is Compose Multiplatform?
  • Q) 66. How are source sets structured in a Kotlin Multiplatform project?
  • Q) 67. How does Kotlin/Native handle memory management and platform interoperability?
  • Q) 68. What are the testing strategies in Kotlin Multiplatform?
  • Q) 69. What are the dependency injection strategies in Kotlin Multiplatform?

Timeline & Milestones

2026.01.05
First edition published