Why I’m excited about Kotlin

I recently read about Google App Engine Standard’s support for Java 8 and noticed an “alternative” language named Kotlin is also fully supported. I’d heard about other JVM languages like Clojure, Groovy, and Scala but this was the first I could recall hearing about Kotlin.

After a brief overview, I knew I wanted to try out a small example and figured a minimal App Engine app would be a good start. Before getting into that, I want to talk about what I found immediately interesting about Kotlin.

Static typing

While working with Java and JavaScript on a regular basis, I’ve come to appreciate the merits of both languages while also gaining insight into their disadvantages. As code complexity increases, a compiler enforced type system helps to reduce errors and when used properly, can improve code readability. I’m glad to see another statically typed language with an opinion on generics and null safety.

First class functions

First class functions have been JavaScript’s number one feature for me as it has opened up a whole area of learning that I otherwise wouldn’t have been as involved with. I enjoy the flexibility to program in a functional style or an object-oriented style depending on the situation, and I’m happy to see that Kotlin shares this flexibility.

No checked exceptions

One of the most annoying aspects of Java code is having to weed through superfluous exception handling due to the overuse of checked exceptions. I’m glad to see another language that has taken a position against them.

JVM

Java has its supporters and detractors, but the JVM itself has far greater support and is widely accepted as a reliable and performant application base for many use cases. I haven’t worked with any JVM languages other than Java and I’m looking forward to experiencing JVM development within a different ecosystem.

Official Android support

Kotlin is officially supported on Android. It also supports transpiling to JavaScript and native compilation for iOS or embedded systems. According to the announcement post the vision “is to make Kotlin a uniform tool for end-to-end development of various applications bridging multiple platforms with the same language. This includes full-stack web applications, Android and iOS clients, embedded/IoT and much more.” I’m not sure how appropriate it is for each of those scenarios right now, but I’m happy to see that there is so much ambition for cross-platform support.

Documentation

The reference is full of great examples and explanations for certain language features. While covering the features, structure, syntax, and other necessities, it also serves as a basic guide on writing idiomatic code. Reading through the documentation is pleasant and inspiring. This gives me confidence in the language and in my ability to learn to apply it in an elegant fashion within a reasonable time frame.

Up next

A minimal App Engine app using Kotlin.