Has been a long time since I found an interesting programming language which changes the way you approach solving problems in certain areas. Last time I was into JavaFX Script however it didn't take off as expected mainly due to the Java community not embracing it in general, the language was too specific (domain orientated), and not enough resources were being allocated to improving/supporting it. Also when trying to use JavaFX Script in projects the interoperability with the Java ecosystem (JPA, JAX-RS etc) often ended up being a show stopper.
By chance when looking at alternatives for Android development I discovered Kotlin. Kotlin is reasonably easy to learn with its difficulty sitting in between Python and Java. What ended up being really attractive about the language is its pragmatism/industry driven approach to software development. Many features in Kotlin are very well thought out with every single one being a result of Software Engineering experience in the industry (ICT). There aren't many programming languages that manage to balance conciseness with readability. You end up more often than not reading rather than writing code.
One of my favourite Kotlin features is Delegated Properties, specifically storing properties in a Map. Below is an example of this:
What you have above is an example of bidirectional Data Binding (sort of), which opens up a number of interesting real world applications like binding a database model (the model class, not the actual database) to a view. Despite the MutableMap using mixed types for the values it works just fine for the Person properties that rely on type inference via delegation. Blogger unfortunately doesn't have syntax colouring support for Kotlin code, is Google planning to fix this?
Some people view Kotlin as a statically typed version of Python however it isn't entirely warranted. If anything Kotlin is most similar to Swift. Even the language goals are very similar:
- High performance
Kotlin documentation isn't too bad (the quality of the references is good) however it is seriously lacking a decent tutorial. Confusingly the navigation of the documentation section of the Kotlin website is all over the place. The Kotlin Koans for instance is in the Tutorial area instead of the More resources area. There appears to be a “Getting Started Guide” in the Reference area. If it is a tutorial then it needs to be moved to the Tutorial area.
Some Kotlin design decisions are questionable/controversial. Closed (sealed) classes are one decision which is very odd considering that there are a significant number of libraries/frameworks that rely on open class design, and Software Engineers frequently design software using an open class architecture anyway. Another one is Data Classes where some implemented functions are included for free (toString, equals, hashCode), and object de-structuring is automatically supported, which should be in ordinary classes instead. Using Data Classes causes severe issues (no class inheritance etc) that would be easily avoided by going with ordinary classes anyway.
Below is a list (not exhaustive) that shows who is using Kotlin:
- NBC (NBC News, TODAY, and Nightly News Android apps)
- American Express
- Pivotal (own Spring framework)
- 3D Robotics (3DR Tower Android app not available in Google Play)
- Basecamp (creator of “Ruby On Rails”), Basecamp Android app
- BQ (various Android apps not available in Google Play)
- Meizu (various Android apps not available in Google Play)
- App Foundry
- Allegro Group
- Bryx 911 (first responder Android app not available in Google Play)
- Trapit (builds Android apps for some fortune 500 companies using Kotlin)
- Farm Logs (Android app not available in Google Play)
- Nulab Inc (Android app not available in Google Play)
- Anko (official Android application development library for Kotlin)
- Kotter Knife (Android view binding library for Kotlin)
- TornadoFX (JavaFX library for Kotlin)
- MapDB (embedded NoSQL DB for the JVM)
- Requery (SQL query and persistence library which has Kotlin support)
- Exposed (official SQL library for Kotlin)
- Spec (official unit testing framework for Kotlin)
- Kara (web framework for Kotlin)
- Quasar (JVM concurrency library which has Kotlin support)
- Spring Boot (micro services framework which has Kotlin support)
- Gradle (version 3 onwards has support for developing plug-ins using Kotlin)
- RxKotlin (RxJava bindings for Kotlin)
- Keep Safe
- mySugr Diabetes Logbook
- Level Money
- App Dialer
- Bus Radar
- Bodyweight Fitness Pro (nearly all of the app is written in Kotlin)
- Material Audiobook Player
- Runnr Food Ordering
Kotlin Jobs (Possible Users)
- NEWSCYCLE Solutions
- techdev Solutions GmbH
One of the major surprises with Kotlin is the significant interest in the language from the Android Development community. Certainly helps when Jake Wharton (likely the most well known person in the Android Development community) is endorsing Kotlin. Many in the community want Google to support Kotlin as an alternative to Java.
In Fragmented postcast #20 an out of blue question was asked by one of the presenters, “When is Google going to support Kotlin in Android Studio?”. Why hasn't Kotlin been covered in an Android Developers Backstage podcast yet? Since late last year there have been a few Googlers frequently visiting the Kotlin slack channel, which has recently celebrated reaching the 4000 registered users mark.
As you can see it is highly unlikely Kotlin will be going away considering the sheer number of major companies and Android apps using Kotlin. If anything this shows that all Java developers should be seriously looking into using Kotlin for some projects if they haven't done so already. Kotlin is highly likely to represent the biggest change to the JVM landscape after Java 8.