Watermarked preview · swipe or use ← →
Write Real Code from Day One
Most Kotlin books teach you just enough to get started, then leave you stranded when you try to build something real. Kotlin for Absolute Beginners takes a different approach: from page one, you write real code for a real application, KontactBook, a fully functional contact manager, and you keep building it across all 15 chapters until you have a shippable, tested, coroutine-powered application with an HTTP API.
No prior Kotlin experience required. If you can write a function in any language, you have everything you need.
WHAT YOU WILL BUILD
KontactBook starts as five lines of code and grows into a complete application: validated user input, a data class model, in-memory collections, JSON persistence, file I/O with atomic writes, automated testing with JUnit 5, non-blocking coroutines, and a REST API served with Ktor. Every chapter adds a real feature. Nothing is thrown away.
WHAT YOU WILL LEARN
The first five chapters cover the language foundation: variables, types, null safety, control flow, and functions. Kotlin's type system, and especially its null safety model, is where the language earns its reputation. You will learn not just how to write null-safe code, but why it matters and what it prevents. The compiler becomes your partner, not your obstacle.
Chapters 6 through 9 introduce the object-oriented and functional layers: classes, data classes, sealed class hierarchies, interfaces, and the full error handling model. You will replace KontactBook's early Triple (String, String, String) data model with a proper Contact class, then build a ContactBook that enforces business rules through the type system.
Chapters 10 through 12 address the practical realities of software: kotlinx.serialization for type-safe JSON encoding and decoding, lambdas and the standard library functions that make collection transformations readable, and a comprehensive JUnit 5 test suite that verifies every layer of KontactBook.
Chapters 13 and 14 move into concurrency and networking. You will convert KontactBook's blocking file I/O to suspend functions using Kotlin coroutines, learn how structured concurrency manages lifetimes and cancellation, and add an HTTP API with Ktor that handles requests as coroutines. Chapter 15 packages the finished application into a fat JAR and wraps up the complete KontactBook codebase.
WHY THIS BOOK IS DIFFERENT
Every concept is introduced at the moment it solves a problem you have already encountered in the project. Null safety appears when a real nullable return type creates a real risk. Coroutines appear when blocking I/O creates a real bottleneck. This is not top-down theory followed by disconnected examples; it is bottom-up learning driven by real requirements. By the time you finish, you will understand not only how Kotlin works, but why it was designed the way it was.
Each chapter ends with eight multiple-choice questions and a complete answer section with explanations. Code is commented to explain the why, not just the what. Every listing compiles and runs against the current Kotlin toolchain.
No reviews yet — be the first to share your thoughts.
Share your experience with this book. Reviews are moderated before publication to keep discussions useful and respectful.