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.

492
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!

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

"Kotlin has evolved beyond being just a programming language and has established itself as a core pillar of multiplatform development. This book goes far beyond listing basic usage, diving deeply into the language's design philosophy and internal mechanisms. Its structure is especially impressive, guiding readers from casual curiosity all the way to a deep understanding of Kotlin's inner workings.

For junior developers, it turns vague uncertainties encountered in real-world development into clear confidence. For senior developers, it brings together scattered pieces of knowledge into a cohesive big picture. This is a must-read for any engineer who wants to truly grasp the core of Kotlin."

SeongUg (Steve) Jung

SeongUg (Steve) Jung

Principal Software Engineer @ Grab

Ex-Google Developer Expert for Android

LinkedIn
Original text

Kotlin은 이제 단순한 언어를 넘어 멀티플랫폼 개발의 핵심으로 자리 잡았습니다. 이 책은 단순한 사용법을 나열하는 데 그치지 않고, 언어의 설계 철학과 내부 메커니즘을 집요하게 파고듭니다. 가벼운 호기심으로 시작해 언어의 심층부까지 도달하는 구성이 매우 인상적입니다.

주니어 개발자에게는 실무에서 마주할 막연한 의구심을 명쾌한 확신으로 바꿔주고, 시니어 개발자에게는 흩어져 있던 지식의 조각을 하나의 큰 그림으로 완성해 주는 필독서입니다. Kotlin의 핵심(Core)을 꿰뚫고 싶은 모든 엔지니어에게 일독을 권합니다.

Shoutouts & Community Reviews

See what the Kotlin community is saying about the book

Community Feedback
Community Feedback
Community Feedback

Book Preview

Take a look inside before you buy

Enjoyed? You can read more of this book on:

Available in Multiple Languages

Translated editions for the global Kotlin developer community

Proudly Supported By

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.06
Reached 100 copies sold 🎉
2026.01.03
First edition published