about this book

Who should read this book

The goal of this book isn’t simply to help you learn the Kotlin language, but also to teach you how you can write much safer programs using Kotlin. This doesn’t mean that you should only use Kotlin if you want to write safer programs and, even less, that only Kotlin allows writing safer programs. This book uses Kotlin for all examples because Kotlin is one of the friendliest languages for writing safe programs in the JVM (Java Virtual Machine) ecosystem.

This book teaches techniques that were developed long ago in many different environments, although many of those come from functional programming. But this book isn’t about fundamentalist functional programming. This book is about pragmatic safe programming.

All the techniques described have been put in production in the Java ecosystem for years and have proven to be effective in producing programs with much fewer implementation bugs than traditional imperative programming techniques. These safe techniques can be implemented in any language, and they’ve been used by some for many years in Java. But often, using these techniques has been accomplished through struggling to overcome Java limitations.

This book isn’t about learning programming from level zero. It’s aimed at programmers in professional environments who are looking for an easier and safer way to write bug-free programs.

What you’ll learn

Pushing abstraction further


Referential transparency

Encapsulated state mutation sharing

Abstracting control flow and control structures

Using the right types



How this book is organized: A roadmap

Completing the exercises

Learning the techniques in this book

About the code

liveBook discussion