If you clicked on the article, you might have a fair idea about where I’m headed. At the annual I/O developer conference, Google declared its love for Kotlin to the applause of the Android app development community. But where does this leave Java? How does it change mobile app development? And what made Google prioritize Kotlin over Java in the first place?
Why Google wanted something better than Java?
First off all, Google doesn’t intend to get rid of the entire Java ecosystem, although it sure wishes it could. But it always has looked for better alternatives to the Java programming language for android app development.
It may have started back in 2010 when Oracle, the new owner of Sun Microsystems filed a lawsuit against Google for copying the Java API for building the Android OS. The 9-year-old legal battle has seen various twists and turns. The best defense Google has had in the case was that API’s were non-copyrighted. But Oracle insisted that they were and that Google didn’t license the Java API before using it.
This does not mean that we’ll lose Android if Oracle wins the case. Because Google averted such a possible scenario by building all versions starting from the Android 7.0 (Nougat) with the open-sourced version of the JDK (Java Development Kit).
But yet, Google has always wanted to get away from the ecosystem. Java is a near-universal programming language. But whether android developers dread it, run from it, the need for Java still arises in one form or the other. That is why they had to find something that does not replace java but becomes an alternative to it. A language that is more fun to use than java and a language that is interoperable with it. Thus came Kotlin!
Also Read: Eleven Trending AI Chatbot Platforms
Why Google chose Kotlin as a primary language for android app development?
Kotlin isn’t a new language developed by Google. It is an open-source language developed by JetBrains (a well-recognized development partner with Google) back in 2011. But it never received the recognition it deserved until Google introduced Kotlin as an official language for android app development along with Java and C++ at its annual I/O in 2017.
Since then, there has been no turning back for Kotlin. What made the dish even better was the fact that Kotlin got all the support it required from the IDE. This was owing to the fact that JetBrains, the company behind Kotlin also build the core of Android Studio, i.e., IntelliJ.
The collaboration and support for kotlin from both Google and JetBrains ensured that Android developers could easily migrate from Java to Kotlin without any hiccups. Soon, Android developers began to realize the benefits of Kotlin over Java for Android app development, some of which were:
- Developers could write concise, yet expressive codes in comparison to the verbosity in Java coding.
- One major complaint with Java for Android app development was the NullPointerException. Kotlin addressed this issue by forcing developers to explicitly allow variables to be null and negate any such problems.
- It is generally hard for developers to migrate to new languages, especially when you’re used to developing android apps on a language as old as Java. This issue was easily addressed by the Android Studio’s Java to Kotlin conversion feature which let developers convert Java code directly into Kotlin.
These key benefits and more of them eventually led 50% Professional android developers to switch to kotlin and embrace the change. Kotlin is one of the most-loved languages today, as per the results of Stack Overflow’s annual developer surveys in 2018 and 2019: two years in a row!
Kotlin was the 2nd most loved Programming language in 2018 as per the Stack Overflow Annual developer Survey. Source: StackOverflow
Kotlin moved down to 2 places as the 4th most loved Programming language of 2019 as per Stack Overflow’s annual Developer survey. Source: StackOverflow
The icing on this cake came at the Google I/O 2019 in May when Google itself announced that Android development will go Kotlin-first, and encouraged developers to leverage the Kotlin language for mobile app development.
The road ahead for Android app development with Kotlin
Google does not intend to replace Java by introducing Kotlin and promoting its use in android app development. But it simply needs something to run along with the former.
Kotlin itself runs on the Java Virtual Machine (JVM), which is why for the end-user, the new programming language wouldn’t make much of a difference. Therefore it isn’t even fair to compare Kotlin with Java as it has happened lately. Kotlin is Java. You can have your Kotlin code converted into Java, and you will have your kotlin code running on the JVM anyway.
But the fact that Kotlin is one of the fastest growing programming languages cannot be disputed. In a span of 6 years, Kotlin managed to enter the Top 50 Programming languages in the TIOBE index. This itself shows the potential of kotlin as a fun, productive programming language for developing android apps.
But is this growth eternal, or will Kotlin eventually get overtaken by a different upcoming language? The chances for such a scenario seem to be dim for now. But Oracle knows the significance of Java in android app development and beyond. So it’s not that hard for them to ship Java with a few upgrades in its next version to take on Kotlin.
To summarize everything, Kotlin became google’s recommended choice for mobile app development because Google wanted it to be! Kotlin was designed to be better than Java. It was meant to be a ladder which android app development companies can climb and migrate away from Java to something supposedly better.