The Kotlin Primer is an opinionated guide to the Kotlin language which will help you learn Kotlin at a professional level. A large part of it was originally written as an organizational learning resource for Etnetera, and I would like to express my sincerest gratitude for their support.
The Primer is much more than your average Kotlin tutorial - it's tailor-made to facilitate Kotlin adoption inside Java-centric organizations. As such, it was designed to be accessible to developers of all seniorities and assumes very little on the readers' part. It is written for, and successfully tested in, the real world, with real people, working real jobs, in a real business. Furthermore, the Primer isn't just about Kotlin - the concepts and techniques you'll learn while reading it apply to a wide range of programming languages, and learning them will make you a better programmer in all of them.
But most of all, Kotlin is a language that's inherently fun, and I promise you'll have loads of it while reading the Primer.
If - and only if - you're so overjoyed by what the Primer has to offer that you feel a simple "thank you" doesn't cut it, you can Buy Me a Coffee using the at the bottom of any page.
Finally, be sure to follow me on Twitter/X to get notified about new articles.
I'm delighted you're here - let's get started.
![A painting of a delighted programmer sitting at his desk, with a nebulous explosion of colors bursting from where his screen would be.](https://www.kotlinprimer.com/wp-content/uploads/2023/10/programmer_learning_kotlin_2.webp)
Is the Kotlin Primer for you?
You can benefit from reading the Primer if:
You have no experience with Kotlin
The Primer starts from the basics and makes absolutely no assumptions about existing knowledge, beyond basic familiarity with Java. You will learn not only the mechanics of the language, but also how to write idiomatic Kotlin in a consistent way, which features to use in which situations, and why. You will also learn design methodologies that promote maintainability and are applicable outside of Kotlin as well.
You already have experience with Kotlin.
There are three reasons for this.
The first reason is that the Primer thoroughly analyses the βsoftβ aspects of writing in Kotlin. For example, you probably know what the individual scope functions are, but do you know when you should use which? Can you give logical and consistent reasons for those choices? Are those reasons motivated by a specific purpose, or are they ad hoc (e.g. βbecause thatβs what the docs sayβ)? Regardless of which answers you gave, being confronted with the approach taken in the Primer can potentially widen your perspective.
The second reason is that part of the Primerβs value lies in subjects that are not specific to Kotlin. For example, the Primerβs treatment of generic variance is, to my knowledge, somewhat unique. Some subjects, such as functional domain-modeling, pertain to programming methodologies that directly promote maintainability, and I firmly believe that programmers of any experience level can benefit from being exposed to them.
The third reason is that the Primer includes curated links to quality materials elsewhere, collected through hundreds of hours of sifting through online material. In a few cases, the articles are so good that it is difficult to overstate their quality β those are usually mentioned in a visibly enthusiastic manner.
You are pressed for time.
The Primer is tailored to the environment of organizations like Etnetera, where revenue is generated by billing time β time literally is money. As a consequence, the Primer only discusses things where it has something of value to say. It starts out fast, since language beginnings are straightforward, but slows down considerably as it progresses to novel material. It does not waste time where it is not needed and refers you to the documentation whenever its contents are sufficient, or gives TL;DR-style rundowns.
The Primer spans 90 articles, which total to approximatelly 8 hours of reading time. However, it has been my experience that the amount of time it takes to complete the Primer cover-to-cover is typically 2β3 MDs, depending on seniority and familiarity with Kotlin.
You want to learn the theory, but also the practice.
As was mentioned, the Primer is, in a sense, a compilation of my experience using Kotlin. It is not a generic textbook, but also imparts opinions based on real-world experience. These opinions, and the reasons for them, are always motivated, thoroughly explained, and unapologetic, even when this means being in conflict with the official documentation.
You like a hands on, no-nonsense approach.
The Primer uses embedded Kotlin Playground code to provide interactive demonstrations for all the material, which can be edited and run directly from the article page.
Additionally, every article introducing a new concept includes exercises that can be run and validated directly from the page of the article. The exercises are designed to really drive home how things work, are validated by tests, and often require some effort to solve.
The Primer does not waste time with trivial exercises that serve only to frustrate the intelligent reader. It has faith that you can indeed write a function that sums two integers, and doesnβt really feel you need to prove it. It is for this reason that there are no exercises until the article on Nullability.
Read on to understand how the Kotlin Primer is structured, what it contains and what it doesn't, and how it should be read.