Kotlin – just another programming language?
Recently, I attended the Kotlin programming language conference, aptly named KotlinConf, to learn about the latest developments in the language.
Naturally, my first idea for this blog was to list the top takeaways of the talks I attended. However, I thought it could be more useful for those who aren’t familiar with Kotlin yet to take a step out of Kotlin fanatic land, and spell out what all the fuss is about. There must be a reason KotlinConf has sold out three years in a row, right?
So WTF is Kotlin anyway?
Kotlin is a general-purpose programming language that can be used across a variety of platforms. Version 1.0 was launched by JetBrains in 2016, both on the Java Virtual Machine (JVM) and Android, after considerable testing and consultation with the tech community.
If you don’t know JetBrains you’re about to realise that you probably do. They make tools that make developers’ lives easier. IntelliJ, an Integrated Development Environment (IDE) is probably their best-known product and is becoming somewhat ubiquitous in Java world. Outside of the JVM they have popular IDEs for languages such as Python, PHP and .NET.
JetBrains’ mission to make dev lives easier is at the core of Kotlin. It’s interoperability with Java, friendly syntax and modern implementation has made it a tempting new toy to play with for many Java developers. It is something new and fun but also something safe and familiar.
Cool, why should I care?
Being a baby relative to Java (which was launched over 20 years ago), might make you think that this language is still experimental, the stuff of party tricks for super nerds. But Kotlin has seen rapid adoption across a number of industries since its first stable release in 2016.
Since then, the number of users who have edited Kotlin code (including just for fun), has grown from 200,000 to over 4 million.
Trifork was an early adopter of Kotlin, first using it in a project for a customer in 2017. Over 6000 online student tests are now run each day through the Mindsteps system.
And it turns out we’re in good company. Many more companies are realising the benefits of running Kotlin in production:
Google – made Kotlin an official language of Android in 2017. So if you have an Android phone, chances are there is Kotlin app running on it. The Google apps Drive, Sheets, Docs, Home and Nest are all built with Kotlin.
Netflix – the streaming service has written its in-house build and deployment tools in Kotlin
N26 – Europe’s online bank, that has turned traditional banking on its head. An early adopter of Kotlin, it is now a major programming language for their backend services
Norwegian Tax Administration (NTA) – has been running the nation’s taxes in Kotlin for several years now
Does Kotlin replace Java?
Kotlin is certainly an alternative to Java. A very real alternative. Java has been around for a very long time and as a result, it is a mature technology with a well-supported ecosystem and large community. What makes Kotlin a promising alternative to Java, in my opinion, is twofold:
- Java Developers can continue to use familiar tools and frameworks (such as Spring Boot) thereby flattening the initial learning curve. Feeding into this is the interoperability of Kotlin code with Java code. It is possible to utilise familiar Java libraries in Kotlin code. You can even have files of both languages in the same project!
- Kotlin is concise yet expressive, which reduces maintenance overhead and improves readability. It also builds upon many lessons learned in Java, such as the “billion-dollar mistake” of nullability. And it’s fun!
But will Kotlin replace Java? Maybe, but not for a while. The new release cadence of Java has resulted in an increase in the frequency that new language features are released. So, it is also able to keep up with the pace of technological change faster than it previously has. This will maintain the inertia of a lot of people who have spent the bulk of their careers programming in Java.
What about frontend?
Kotlin/Native is now in beta, with a stable release on the roadmap for next year. Kotlin/Native takes a step away from virtual machines. Instead, it compiles to specific platforms, allowing you to reuse more code in multiplatform environments. The most obvious use case for this would be for mobile applications built for both iOS and Android.
From what I’ve seen, there is still a fair amount of platform-specific coding required to get both an iOS and Android app out in the market. However, the neat thing about Kotlin/Native is that you can share significantly more code across platforms, which has the potential to offer real benefit to teams building and maintaining apps. It will be interesting to see how this aspect of the Kotlin ecosystem evolves.
So there you have it, my crash course into the world of Kotlin. If you have any questions or comments, leave them below or email me at email@example.com.