What is Kotlin, Another Gimmick, or the Future of Android Development?

Andrei Klubnikin
4 min readMar 12, 2018

When Google announced official support for Kotlin, many IT experts and developers started to question the future of Android Java — and there are several reasons for that. Although proper Java and Android API are different as night and day (the simplified version of Java Virtual Machine for Android devices, limited usage of Java libraries, etc.), Google has been in a nasty legal battle with Oracle over “unauthorized use of Java APIs” for years. Android developers are tired of system crashes, vulnerabilities, and memory leaks. Also, the pace of the mobile development technology change leaves no room for verbosity and ceremony. What we need is less code and shorter development time — and that’s where Kotlin comes in handy.

What is Kotlin & why use it for Android app development?

Kotlin, a statically-typed programming language that is 100% compatible with Java, can be compiled to JavaScript and runs on the Java Virtual Machine (JVM), was created by JetBrains (which is a Czech software development company) back in 2010. JetBrains’ major goal was to design an industrial-level object-oriented programming language that would be fully compatible with existing Java and Android projects and still eliminate some of the biggest issues of Java programming including nullity and excessive coding. Over the years, the language had gone through many stages before its stable version was unveiled in 2016. Last year, Google added Kotlin as an official language for Android apps; Kotlin then made an enormous jump in the TIOBE index and is currently holding strong at 38.

Why use Kotlin on Android?

Kotlin is a mature programming language. Unlike Swift and other “new things” on the market, Kotlin did not come out of the blue. JetBrains was making Java-based apps for project managers and software developers for years and had too much Java code to maintain; obviously, they couldn’t re-write the whole thing in a new language and call it a day. Step by step, they created Kotlin as a language that would complement Java rather than replace it and borrowed cool features that could possibly be implemented on JVM from other programming languages. These features include Domain Specific Languages (DSLs) enabled in Apache Groovy, delegates from C#, higher-order functions (Python, C#, Scala), etc.

With Kotlin, you write significantly less code. Writing “Hello, world!” in Java will take you up to three lines of code; in most modern programming languages, it’s just three words. More code means more bugs and more time needed to fix them. Apparently, if you convert an Android app to 100% Kotlin, you’ll be able to reduce the total amount of code and method count by 30% and 10%, respectively!

Kotlin and Android Studio is a match made in heaven. To begin with, Android Studio is basically a customized version of IntelliJ IDEA — a Java integrated development environment that was also created by JetBrains. In order to start coding in Kotlin, you simply need to download the Kotlin language support plugin from the JetBrains website. Obviously, all of Android Studio’s features work seamlessly with Kotlin. You can even mix Kotlin and Java in one and the same project and convert the latter to Kotlin!

Being mobile-first, Kotlin still targets multiple platforms. Compared to Java and Objective-C, Kotlin was specifically designed to address performance, design, and security issues that stem from limited RAM, short battery life, etc. What’s more, it is the first programming language that can be used for Android, iOS, web, and wearable application development (with every module written natively).

Will Google abandon Java?

Back in 2016, I published an article of the same name on Medium. Amidst the Oracle-Google lawsuit, I found too many reasons why the latter should stick to Java. Some of them (like rolling out software updates to existing smartphones and Java’s further evolution) are still relevant today. Back then, however, no one took Kotlin seriously; in fact, Android gurus’ opinions were divided between Dart and Sky as a potential Java successor.

With the introduction of Kotlin, however, several mobile analytics agencies including Realm Report stated the new language would overtake Java for Android application development by December 2018.

Will Kotlin really outpace Java as the #1 language on Android?

According to my colleague Dmitry (who is a senior Android developer at ITRex Group), the chances Google will eventually swipe Java for Kotlin are close to zero — at least for now. With a trillion lines of Java code and a million businesses hinging on it, switching from Java to any other language is like trying to replace the modern English alphabet with the Arabic script. Sure, you can convert existing Java files to Kotlin, but automated Java-to-Kotlin converters often produce incorrect code.

What IS possible, though, is full support for several programming languages including Java, Kotlin, C/C++, etc. — and it’s already happening!

Although just 0.48% of all Android apps contain Kotlin at the moment, the number of top applications which use the language is estimated at 6.8%; these include Twitter, Pinterest, and Netflix. The 2017 Kotlin conference drew a crowd of 1.2 thousand developers from all over the world. Getting started with Kotlin is a piece of cake; in fact, it’s more like Java++ than a different programming language.

Why not give it a go then?

--

--

Andrei Klubnikin

Content marketer. Tech blogger. Passionate reader. Yoga amateur. Cat dad.