Google announced that the Kotlin programming language will now be a first class citizen alongside of Java for Android development. Since Apple had announced Swift as the replacement for Objective-C as the iOS app development programming language, there’s been a lot of speculation on what Google might do in response; some commentators even speculated that Google might also go with Swift. Google has now made their move and it’s a really smart one. Coder Radio listeners will know that I’ve been a long-time fan of Java, but I have to say if there’s going to be a successor to it, then Kotlin seems like a great choice.
For starters, it targets the JVM. That means that Kotlin code can be run on a wide variety of architectures and devices. For the purposes of Android development this was essential, since Android uses a “version” of the JVM; there’s been some legal cloud about what exactly Google’s Davlik VM was a bit too much like the JVM for Oracle. If you’ve never had a “standard” disappear on you, then you might not understand how much of risk there is in technologies simply evaporating into the air, leaving you and your users high and dry.
Speaking of the longevity of technologies (especially in the enterprise), Kotlin targets Java 6. What that means is the there’s a huge pool of enterprise Java applications that it can work on today using its interoperability with Java. In practical terms, this means that there’s no need to rewrite your legacy Java application to start writing modules in Kotlin.
Java can be a little strict in terms of checked exceptions. Basically, in Java, if there’s a possibility to throw an exception it must be checked with a try / catch block. In larger projects this makes you’re code pretty verbose and I’ve long found this to be one most annoying aspects of Java day to day. Kotlin does not have checked exceptions, giving you more flexibility in how you write your code and reducing all around cruft.
If you’re an Android developer or just a Java developer in general, I urge you to take a look at Kotlin and form your own opinion. Also, if you’re interested in learning more about Docker or DevOps in general, take a look at my Docker Compose Quickstart Guide and follow me on Twitter!