Do you want to learn Kotlin? Wonder what resources you should use to learn it? In this article I collect a few different resources depending on your interests and skill level. You might pick a few, mix and match or do whatever you want that makes you learn the concepts. Only you know the way you learn things the best. Without further ado, let us dive into the resources!
NOTE! When I recommend books, I use Amazon Affiliate links. This means I will earn commissions for qualified purchases.
Learning the basics
No matter your skill level, you will at some point refer to the official language documentation. For many of you, this will probably be the best place to start as well. All the examples can be run directly on the website, but you want to try your own code snippets interactively you can do it on play.kotlinlang.org. If you already know Java, they have an interactive track called Koans that teach you the basics of Kotlin. This program help you get familiar with the syntax and workings of the language.
There is probably two groups of people who end up reading this blog post; people new to programming in general, and people who know some programming and want to learn Kotlin. My recommendations are a bit different depending on which group you belong to. You may mix and match, but complete beginners will have a harder road with the resources aimed at people familiar with programming and/or the Java/JVM ecosystem.
- Complete beginner: If you are set on learning Kotlin as a beginner, I think I would start with the Head First Kotlin book. It covers several programming concepts, and teaches you Kotlin from the ground up. It claims you should have some very basic scripting experience, but I think it is achievable with some effort (maybe supplement the official documentation above?). JetBrains Academy might be worth checking out, but I don't know too much about it. They describe their approach in this YouTube video.
- Familiar with programming and/or the Java/JVM ecosystem: The absolute BEST book on Kotlin in my view is Programming Kotlin by Venkat Subramaniam! It goes through the basics, as well as some examples using Spring and also creating Android applications. Several often ignored parts of the Kotlin syntax is covered, and even I learned something new when reading it a few years ago (I had programmed in Kotlin for almost a year by that point). It requires that you know the basics of programming, and also assumes that you know about the Java ecosystem, but it is manageable in my view. I know someone who have read it and only knew some C programming, and they were able to start programming Kotlin after reading at least parts of the book! One exercise those of you who are more experienced may find useful is to refactor one of your Java applications to Kotlin.
If you want to edit your files locally, you will also need an editor of some kind. Kotlin is created by JetBrains, the creators of IntelliJ IDEA. I would say that most people end up using IntelliJ IDEA for Kotlin, as they find it has the most complete tool support for the language. Other people, like myself, have a very strong preference for other editors like Emacs. On this blog you will find several articles about Kotlin in Emacs, one recent and one older. The details mentioned in those articles can probably help you configure Kotlin IDE functionality in other editors, like Vim, as well.
So you know the basics now, and want to keep on learning new concepts. The play.kotlinlang.org site have lots of hands-on labs you can try, even though most of them probably are meant a bit for intermediates. If you want to learn a specific concept, like Native, Multiplatform, Spring Boot etc., then they might be worth a try. To stay up to date with Kotlin, Jetbrains has an excellent YouTube channel with talks, news about new features and more. There are several videos on their channel, ranging from basic concepts to more advanced topics:
- Kotlin Standard Library safari: Tips on using the standard library and often overlooked parts of it.
- Evergreen Kotlin tips (usage of the Elvis operator, fully qualified names, nullability etc.)
- If you use Spring, or want to, then the Spring Time in Kotlin series is worth a watch. At least the videos containing what you are interested in. They cover reactive programming, coroutines and more.
- Some of you learn by seeing other people solve programming problems, like this interview problem.
There are also some resources you can check out based upon other topics:
- Android development: Google announced first-class support for Kotlin in 2017, replacing Java. Development is covered extensively in its documentation, including toolkits like Jetpack Compose that makes Android development more comfortable.
- Compiling to native code (iOS, Linux, Windows, etc.): Want to interface with C libraries? Or make native applications for phones like iPhone? Then Kotlin Native is probably for you.
- Multiplatform codebases: This potentially combines the previous point with Android development, server side apps, frontend apps and more. Multiplatform projects help you share code between several targets. This can help you make applications for Android and iOS, fullstack web apps and more! I'm not very familiar with this, but it seems interesting.
- Kotlin for scripting: Want to replace clunky big bash scripts with Kotlin code? Or maybe you just prefer automating with Kotlin instead of Python or NodeJS? KScript makes this easy!
- Domain specific languages in Kotlin: I mentioned Venkat Subramaniam earlier, and he have written a book about domain specific languages in Kotlin. Might be worth checking out if you find the concept of domain specific languages useful. There is also an article on this blog about that topic.
- Kotlin syntax and features you may have forgotten? There is an article on this blog for that!
Enjoy listening to podcasts? There is actually a podcast about Kotlin where they talk about libraries, approaches at companies etc. It's called Talking Kotlin, and is available where you usually listen to podcasts.
If you want to do software development professionally, I wrote an article with book recommendations for that a few years ago. It has a slight focus on the Java ecosystem, but many of the books are useful either way.