Monday Apr 15, 2013

A new article, up on otn/java, by yours truly, titled “The Advent of Kotlin: A Conversation with JetBrains' Andrey Breslav,” explores the new statically typed language, Kotlin, which was named Language of the Month in the January 2012 issue of Dr. Dobb's Journal. Kotlin is a product of the highly lauded Czech software development company, JetBrains, maker of the Java IDE IntelliJ IDEA. Project Kotlin aspires to create for developers a general-purpose language that can serve as a useful tool that is safe, concise, flexible, and 100 percent Java-compatible. Both the compiler and the IntelliJ IDEA plug-in are open source under the Apache 2 license, with source code available through GitHub.

Breslav, the lead language designer for Kotlin, discusses Kotlin's features in the interview. Here are some things he points out:

* “Extension functions and properties in Kotlin can be added to any class/type without altering the definition of the class. This enables us to beautify even existing Java libraries so that the good old JDK looks nice and shiny.* Higher-order functions (passing code around as values) are a lot more convenient, because Kotlin supports proper function types (as opposed to Java 8's SAM conversions that make you create a new interface every time you need a new function signature to be passed around).* Declaration-site variance, and variant collections in particular, make common data processing much more natural by eliminating the need for ubiquitous wildcards in generic types.”

Breslav says that Kotlin promotes null safety, through nullable types and “offers control over data modification through read-only collections and data classes and enables safer runtime checks through smart casts.”

He states that Java developers who are in search of a new language will enjoy Kotlin’s clean abstractions, concise syntax, and type safety. Breslav encourages developers to download the compiler and/or a plug-in for IntelliJ IDEA, and start writing their own applications. Any feedback about what developers like and dislike, what they find difficult to understand, and how they are making use of Kotlin will be much appreciated.