Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Roman Elizarov, Svetlana Isakova, Sebastian Aigner, Dmitry Jemerov

Rating No ratings yet

Expert guidance and amazing examples from core Kotlin’s developers! It’s everything you need to get up and running fast. In Kotlin in Action, Second Edition you will learn: Kotlin statements and functions, and classes and types Functional programming on the JVM The Kotlin standard library and out-of-the-box features Writing clean and idiomatic code Combining Kotlin and Java Improve code reliability with Null safety Domain-specific languages Kotlin concurrency Mastering the kotlinx.coroutines library Kotlin in Action, Second Edition is a complete guide to the Kotlin language written especially for readers familiar with Java or another OO language. In it, core Kotlin language developers share their unique insights, along with practical techniques and hands-on examples. You’ll quickly progress from language basics to building production-quality applications that take advantage of Kotlin’s unique features. This new second edition is fully updated to include the latest innovations, and it adds new chapters dedicated to coroutines and concurrency. Purchase of the print book includes a free eBook in PDF and ePub formats from Manning Publications. About the technology Coding with Kotlin means less hassle and more productivity. This JVM-based language offers an expressive syntax, a strong intuitive type system, and great tooling support—plus seamless interoperability with existing Java code, libraries, and frameworks. Kotlin is general purpose, safe, pragmatic, and the premier language of Android development. While the language has grown beyond its initial Java-centric focus, you can still use and integrate with your favorite Java tools and libraries, including Spring. About the book Kotlin in Action, Second Edition teaches you Kotlin techniques you can use for almost any type of application, from enterprise services to Android apps. The authors are all members of the Kotlin team, so you can trust that even the gnarly details are dead accurate. You’ll start with Kotlin funda

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A thorough, authoritative tour of Kotlin written by members of the language team, taking you from syntax basics to idiomatic APIs and modern coroutine-based concurrency. Best for developers who already know Java or another OO language and want to write production-quality Kotlin rather than just translate Java. 【Book Arc】 - **Opening (~0%–10%)**: Frames what Kotlin is and why it exists—its pragmatic, concise, safe, interoperable philosophy, its main use cases (Android, server-side, multiplatform), and how to set up and compile code. Solves the "should I care, and how do I start" question. - **Early (~10%–30%)**: Core language fundamentals in reading order—functions and variables, classes and properties, enums and `when`, extension functions, data classes and companion objects, lambdas, collections and sequences, nullability, and the type system. This is the foundation everything else builds on. - **Early–Middle (~30%–40%)**: Deeper language features for building your own abstractions—operator overloading and conventions, delegated properties, higher-order and inline functions, generics (reified parameters, variance), annotations and reflection, and DSL construction. Moves you from using Kotlin to shaping it. - **Middle (~40%–55%)**: The book's structural pivot into Part 3, introducing Kotlin's concurrency model: suspending functions, coroutines versus threads, and the basics of writing concurrent code. This is where the second edition's major new material begins. - **Late (~55%–85%)**: Structured concurrency in depth—cancellation and error handling, flows as a coroutine-based stream abstraction, and the full operator toolkit (transform, buffer, conflate, debounce, flowOn, and more). Turns concurrency from intimidating into structured and predictable. - **Ending (~85%–100%)**: Error handling and testing for coroutines and flows, including exception propagation, supervisors, `CoroutineExceptionHandler`, virtual-time testing, and Turbine, plus appendices on building projects, documentation, and the ecosystem. Closes the loop on production readiness. 【Key Takeaways】 - **Kotlin is deliberately pragmatic, not novel for its own sake** (Opening): its design values conciseness, safety, and Java interoperability, which explains most of its syntax and library choices. - **Null safety is a type-system feature, not a coding convention** (Early): nullable types, safe calls, the Elvis operator, and platform types make the absence of values explicit and compiler-checked. - **Functions are first-class and lambdas are everywhere** (Early): collection operations, `with`/`apply`/`also`, and higher-order functions are the idiomatic backbone of everyday Kotlin. - **Inline functions remove lambda overhead and enable control flow** (Early–Middle): understanding inlining, non-local returns, and resource-management helpers like `use` and `withLock` is key to writing efficient abstractions. - **Generics go beyond Java's model** (Middle): reified type parameters and declaration-site variance let you express things Java cannot, though with their own restrictions. - **DSLs are built from ordinary language features** (Middle): lambdas with receivers, the `invoke` convention, and infix calls combine into expressive internal DSLs—no special syntax required. - **Coroutines make concurrency structured and sequential-looking** (Middle–Late): suspending functions let asynchronous code read like straight-line code, while structured concurrency ties task lifetimes to scopes. - **Flows model streams, and their operators are composable** (Late): intermediate and terminal operators, buffering, conflation, and context switching give fine control over asynchronous data pipelines. - **Error handling and testing are first-class concerns** (Ending): exception propagation rules, supervisors, and virtual-time testing with Turbine are essential for reliable concurrent code. 【Reading Tips】 - **Read Part 1 linearly if you're new to Kotlin**; if you're an experienced Java developer, skim chapters 2–3 and slow down at nullability (ch. 7) and the type system (ch. 8). - **Treat Part 2 as a reference for API design**: chapters 10–13 (inline functions, generics, reflection, DSLs) reward careful reading but are less urgent for everyday coding. - **Deep-read Part 3 (coroutines and flows)**—it's the second edition's headline addition and the hardest material; work the examples rather than just reading them. - **Use the appendices as practical bookmarks** for build tooling (Gradle/Maven), documentation, and ecosystem discovery. - **Take away the "why," not just the syntax**: the authors are language designers, so pay attention to the rationale behind features—it's what makes the idioms stick. 【Coverage Limits】 This guide is synthesized from stratified excerpts (front matter, table of contents, and chapter overviews); specific code examples, worked exercises, and detailed chapter content are not covered here.
Excerpt 1
th your favorite Java tools and libraries, including Spring. About the book Kotlin in Action, Second Edition teaches you Kotlin techniques you can use for al...
View in text
Excerpt 2
ssing elements in nested collections: flatMap and flatten 6.2 Lazy collection operations: Sequences Executing sequence operations: Intermediate and terminal...
View in text
Excerpt 3
Code written with suspending functions looks sequential 14.5 Comparing coroutines to other approaches Calling a suspending function 14.6 Entering the world o...
View in text
Excerpt 4
tions running on the Java virtual machine (JVM) and Android. It starts with the basic features of the language and proceeds to cover the more distinctive asp...
View in text
Excerpt 5
what their trade or station in life was just by their dress. Manning celebrates the inventiveness and initiative of the computer business with book covers ba...
View in text
Excerpt 6
, allowing you to fix them earlier in the development cycle. The following are some benefits of static typing: Performance —Calling methods is faster because...
View in text
Excerpt 7
code at the same time—is a topic that’s almost unavoidable. User interfaces need to remain responsive while long-running computations are running in the back...
View in text
Excerpt 8
feel as if they were designed for Kotlin in the first place. In this example, you’re defining a simple Spring Boot application, which serves a list of Greeti...
View in text
Tags
AI categories
Programming LanguageKotlinBackend
ISBN: 161729960X
Publish Year: 2024
Language: English
Pages: 560
File Format: EPUB
File Size: 4.1 MB