This is Release 0.1 of Kotlin Quick Reference.
Loving Scala ... and Kotlin
Since 2011 I’ve been using the Scala programming language. I fell in love with as soon as I saw it, so much so that I wrote three books about it:
The only problem I have with Scala is that I enjoy developing Android applications, and with the exception of the Scala on Android project — which hasn’t had a new release since February 24, 2017 — there isn’t a simple way to create Android applications with Scala. So when I looked into Kotlin and saw that it was very similar to Scala, well, I was pretty happy.
What I love about Kotlin
What I love about both Kotlin (and Scala) can be summed up this way:
- The syntax is as elegant and concise as Ruby
- Everything feels dynamic, but it’s statically typed
- Source code compiles to class files that run on the JVM
- You can use all of the thousands of Java libraries in existence
- Just as I’ve seen with Scala, the Kotlin creators state that as a rough estimate, Kotlin requires about 40% fewer lines of code than Java
- Developing Android applications with Kotlin is just as easy (easier!) as creating Android applications with Java
Goal of this book
While there are now many good Kotlin books available, and the documentation on the Kotlin website is excellent, I’ve found that what I want is a quick reference to the Kotlin language. Having used multiple programming languages before — including Scala — I don’t need a lot of discussion about a new language, I mostly just need to see the language’s syntax and some good examples.
Therefore, my goal in this book is to provide a quick reference to the Kotlin language — light on words, and heavy on demonstrating syntax and examples.
The history of this book
This book originally started as a light introduction to the Kotlin language, similar to my own “Hello, Scala” book, whose goal is to help programmers learn Scala fast. However, as I was working on it I realized that what I wanted was a quick reference, similar in style to the O’Reilly “Nutshell” books, or the book, Scala for the Impatient.
Therefore, I started converting my original “Hello, Kotlin” book into this Kotlin Quick Reference. Because of that, and because this is also a very early release of the book, some of the writing style is inconsistent. Some lessons — especially the early lessons — are written in a “Hello, Kotlin” tutorial style, while others are written in a “Nutshell” style. My goal is that in the long term all lessons will be written in the Nutshell style, with lots of source code examples and few words.