Leanpub Header

Skip to main content

Kotlin 實戰深入

解鎖 Kotlin 基礎原理與內部機制背後的「如何」與「為什麼」。

本書將帶你從「如何使用 Kotlin」走向「Kotlin 真正如何運作」,揭示語言的內部實作,釐清位元組碼與編譯器行為,以及塑造 Kotlin 的核心內部機制。如果你希望在語言基礎、協程與多平台開發中撰寫更聰明、更有自信的 Kotlin 程式碼,這本書將告訴你一切為何如此設計。

Hardcover | Paperback | ISBN: 979-8243872744 

This book is a translation into Chinese (Traditional) of Practical Kotlin Deep Dive which was originally written in English

Minimum price

$42.99

$52.99

You pay

$52.99

Author earns

$42.39
$

...Or Buy With Credits!

You can get credits with a paid monthly or annual Reader Membership, or you can buy them here.

Buying multiple copies for your team? See below for a discount!

PDF
EPUB
WEB
478
Pages
37,484Words
About

About

About the Book

Kotlin 實戰深入 《Practical Kotlin Deep Dive》從 Kotlin 的核心語言基礎與內部機制出發,深入解析 Kotlin 背後的「如何」與「為什麼」,並延伸至其 API 的設計理念。本書涵蓋 Kotlin 基礎、標準函式庫、協程、kotlinx 系列函式庫、編譯器內部實作,以及 Kotlin Multiplatform。

本書不僅停留在表層 API 的使用,而是深入 Kotlin 的內部世界:透過實際的 Kotlin 函式實作,解析產生的位元組碼,並說明 Kotlin 編譯器如何解讀與處理這門語言。同時,本書直接引用 KEEP 提案、JetBrains YouTrack 討論與編譯器原始碼,將概念與其起源及設計動機緊密連結,幫助你真正「理解 Kotlin」,而不只是記住 API。

透過循序漸進的內容安排,本書確保你不僅學會如何高效地使用 Kotlin,還能理解語言為何如此設計,讓這些洞見能直接轉化為更優質的程式碼。

為了支持持續成長,本書收錄精心整理的參考資料與延伸閱讀,幫助你在書本之外繼續探索。對於較複雜或不常見的術語,書中以易於理解的註解說明,使進階內容對新手也更友善,同時為資深開發者帶來新的觀點。

「Pro Tips for Mastery」章節深入探討 Kotlin 函式的內部結構、演算法、Kotlin 編譯器的行為,以及在實務專案中至關重要的實作細節。資深工程師可以從中獲得值得深思的細節,進一步精進專業能力;而中階開發者則能藉此提升 Kotlin 知識,建立更扎實的分析思維。

無論你是在優化效能關鍵的程式碼、處理複雜的協程任務,或探索多平台開發,本書都將引導你超越教學範例,深入理解語言設計與內部機制,以更清晰的認知、更強的好奇心與更充足的信心來進行 Kotlin 開發。

Jaewoong Eum (skydoves)

This book is a translation into Chinese (Traditional) of Practical Kotlin Deep Dive which was originally written in English

Team Discounts

Team Discounts

Get a team discount on this book!

  • Up to 3 members

    Minimum price
    $107.00
    Suggested price
    $132.00
  • Up to 5 members

    Minimum price
    $171.00
    Suggested price
    $211.00
  • Up to 10 members

    Minimum price
    $300.00
    Suggested price
    $370.00
  • Up to 15 members

    Minimum price
    $429.00
    Suggested price
    $529.00
  • Up to 25 members

    Minimum price
    $644.00
    Suggested price
    $794.00

Author

About the Author

Jaewoong

The author of this book, Jaewoong Eum (known as skydoves), is a Google Developer Expert (GDE) for Android, Kotlin, and Firebase, an open-source developer created over 80+ open-source libraries and projects, collectively amassing 15+ million downloads annually. The author of Manifest Android Interview book and also the founder of Dove Letter—a subscription-based repository dedicated to sharing, learning, and discussing Android and Kotlin development.

Contents

Table of Contents

序言

推薦序

關於本書

  1. 本書的目標讀者
  2. 本書涵蓋的內容
  3. 如何使用本書
  4. 保持與時俱進
  5. 問題回報

贊助商

  1. CodeRabbit

第零章:Kotlin 語言

  1. Q) 0. 解釋 Kotlin 中的空值安全
  2. Q) 1. Any、Unit 和 Nothing 型別的主要作用是什麼?
  3. Q) 2. 什麼是資料類別,它與普通類別有何不同?
  4. Q) 3. 什麼是密封類別,並解釋其使用場景
  5. Q) 4. 什麼是內部類別,它與巢狀類別有什麼區別?
  6. Q) 5. 何時使用列舉類別?
  7. Q) 6. 什麼是值類別?
  8. Q) 7. 什麼是物件,它與普通類別有什麼區別?
  9. Q) 8. 什麼是伴生物件?
  10. Q) 9. var 和 val 有什麼區別?
  11. Q) 10. 幕後欄位和幕後屬性有什麼區別?
  12. Q) 11. 什麼是委託屬性?
  13. Q) 12. lazy 委託和 lateinit 有什麼區別?
  14. Q) 13. 存在哪些可見性修飾符?
  15. Q) 14. init 區塊何時被呼叫,它的關鍵特性是什麼?
  16. Q) 15. 什麼是高階函式,您可以獲得什麼優勢?
  17. Q) 16. inline 關鍵字的優點和限制是什麼?
  18. Q) 17. 什麼是 reified 關鍵字,使用它有什麼好處?
  19. Q) 18. 如何使用 lambda 運算式?
  20. Q) 19. 什麼是函式型(SAM)介面?
  21. Q) 20. 什麼是擴充,它有什麼優缺點?
  22. Q) 21. 什麼是結構相等性和參考相等性,它們有何不同?
  23. Q) 22. 執行 null + null 操作時會發生什麼?
  24. Q) 23. 什麼是 DSL,如何使用它?

第一章:Kotlin 標準函式庫

  1. Q) 24. Kotlin 中有哪些集合類型?
  2. Q) 25. 集合有哪些類型的轉換運算子?
  3. Q) 26. 解釋迭代器的機制
  4. Q) 27. 什麼是序列及其機制?
  5. Q) 28. 有哪些類型的擴充函式可用於取得集合的部分?
  6. Q) 29. 如何定義物件的排序?
  7. Q) 30. 什麼是作用域函式?

第二章:協程

  1. Q) 31. 什麼是協程?
  2. Q) 32. 什麼是續體,它與掛起函式內部如何關聯?
  3. Q) 33. 協程和執行緒有什麼區別?
  4. Q) 34. 什麼是協程建構器?
  5. Q) 35. 什麼是協程上下文?
  6. Q) 36. Job 的角色是什麼?
  7. Q) 37. 協程作用域的目的是什麼?
  8. Q) 38. 有哪些種類的協程調度器,它們的目的是什麼?
  9. Q) 39. 什麼是 Channel,它們如何運作?
  10. Q) 40. join() 和 yield() 函式是什麼?
  11. Q) 41. 如何在協程中處理例外?
  12. Q) 42. 冷流和熱流有什麼區別?
  13. Q) 43. 解釋 StateFlow 和 SharedFlow 的區別
  14. Q) 44. Flow.flowOn() 運算子做什麼?
  15. Q) 45. Flow.buffer() 運算子如何運作?
  16. Q) 46. Kotlin 的內部機制如何用 FusibleFlow 和 ChannelFlow 優化 Flow
  17. Q) 47. launchIn(Scope) 和 Scope.launch() 有什麼區別?
  18. Q) 48. 什麼是 Flow 轉換運算子:flatMapLatest、flatMapMerge、flatMapConcat?
  19. Q) 49. 什麼是 callbackFlow 和 channelFlow,以及它們的內部機制?

第三章 KotlinX 函式庫

  1. 問題 50. 什麼是 kotlinx-serialization,它是如何運作的?
  2. 問題 51. 什麼是 kotlinx-datetime,為什麼要使用它而不是 Java 時間 API?
  3. 問題 52. 什麼是 kotlinx-collections-immutable,什麼時候應該使用它?
  4. 問題 53. 還有哪些值得注意的 KotlinX 函式庫?

第四章:Kotlin 編譯器與外掛

  1. Q) 54. 什麼是註解處理器、KAPT 和 KSP?
  2. Q) 55. Kotlin 編譯器的結構是什麼?
  3. Q) 56. 什麼是 K2 編譯器?
  4. Q) 57. 什麼是 FIR(前端中間表示)?
  5. Q) 58. 什麼是 IR,Kotlin 後端如何運作?
  6. Q) 59. 如何編寫 Kotlin 編譯器外掛?
  7. Q) 60. 有哪些真實世界的 Kotlin 編譯器外掛範例和用例?

第五章:Kotlin 多平台

  1. Q) 61. 什麼是 Kotlin 多平台?
  2. Q) 62. Kotlin 多平台如何處理平台特定 API 並共享共用程式碼?
  3. Q) 63. Kotlin 多平台中有哪些並發或非同步程式設計策略?
  4. Q) 64. Kotlin 多平台中有哪些 HTTP 網路通訊策略?
  5. Q) 65. 什麼是 Compose Multiplatform?
  6. Q) 66. Kotlin 多平台專案中的原始碼集是如何組織的?
  7. Q) 67. Kotlin/Native 如何處理記憶體管理和平台互操作性?
  8. Q) 68. Kotlin 多平台中有哪些測試策略?
  9. Q) 69. Kotlin 多平台中有哪些依賴注入策略?

結語

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub