Kotlin vs Java for Android Developing – 2018

Google announced at the keynote of the Google I / O 2017 the arrival of a new programming language for Android applications: Kotlin. A real revolution for developers! But how does it compare to Java? Let’s discuss Kotlin vs Java in more detail.

Android is an operating system that will soon celebrate its 10th anniversary. Its architecture involves different programming languages. Until now, Google only supported the Java language to develop the famous applications that you use every day. There are several versions of Java, the most recent of which is named Java 8 (Java 9 is planned for this summer).

Android side, the support of Java 8 is currently in beta after various procrastination of Google on its integration. The version of Java that dates from … 2014! But today Java is a language increasingly decried because modern languages have somewhat old-fashioned. IOS developers did not hesitate to make fun of Android, because Apple has developed its own language: Swift.

Rumours circulated a year ago on the support of a new language to complete Java. But during the Google I / O 2016, we were treated to a radio silence. Google engineers then denied the use of Swift, although the language is open source.

But this edition of the Google I / O has generated great relief among Android developers since the support of Kotlin has been formalized. This programming language developed by JetBrains (to whom we owe especially IntelliJ, the environment that is the basis for Android Studio) is already used by some developers for several months/years, despite the lack of official support.

What is Kotlin?

The addition of this new language also raises many questions. The first and not least is that Kotlin does not require in any case to rewrite all applications. It is quite possible to combine Java code and Kotlin code. We understand why Google has opted for this solution that offers a smooth transition. Kotlin is also a robust and proven language, since it has been available for almost five years and is already used in production on Android applications. Some examples: FlipboardPinterest or Expedia.

What does Kotlin offer?

The list of features would be too long to do, but we can simply summarize them: richer, flexible and concise. An official page details more precisely the differences that can be found with Java .

On stage, Google has said loud and clear: the support of Java, C and C ++ will be the same as today. Kotlin is simply a new supported language.

The genesis of a very promising language

JetBrains is facing a dilemma: its software is developed exclusively in Java, but the language proves less and less adapted to their desire to expand. JetBrains needs a more productive and less restrictive language. The alternative languages of the time do not have the features sought by developers at JetBrains, they decide to create their own language, they will present for the first time in June 2011 during the JVM Language Summit conference. This will be the premise of Kotlin.

This new programming language created by JetBrains allows expressing the same intention, using fewer keywords and characters than Java, without losing clarity and understanding. Product code with Kotlin is more compact, more expressive and less subject to certain programming errors than Java can. It is also as fast as Java at runtime, as well as at compile time.

A need for renewal

Android developers face the same constraints as JetBrains: they feel limited by the version of Java imposed by Google. They spend too much time “thinking code” and not enough “product” and new features. Especially since the latest version of Java, the 8, is slow to arrive in the Android ecosystem, with a lot of promises and novelties to help developers produce more efficiently.

If Java 8 is already available on other platforms, Google is slow to implement it on Android, surely cooled by the case that has opposed to Oracle on its use of Java APIs as part of the design of its virtual machine Dalvik. Some Android developers, frustrated at not being able to take advantage of this latest version, are starting to turn more and more towards Kotlin, just as JetBrains is making its language compatible with Google’s mobile platform.

However, not all Android developers dare to take the plunge: for some, using Kotlin in its code base represents a risk they are not ready to take because before the recent announcement of the Google I / O 2017 it was not officially supported.

And Android Studio?

Android Studio is based on IntelliJ, which itself supports Kotlin. Therefore if you use at least Android Studio 2.0, the IDE knows perfectly how to handle this new language.

A concise language is also less potential errors, and therefore fewer long-term crashes. As application development is easy, it is also hoped that applications and new features will be deployed faster.

If you’re new to Android, do not waste time and go straight to Kotlin!

Leave a Reply