How Android App Development Became Kotlin-first?
If you have reached here, it means you already have a fair idea about the changes brought about by Google recently to Android app development. Much to the appreciation of the developers’ community, Google announced in at the annual I/O conference that Kotlin is its preferred programming language for Android app development.
Google mentioned in its blog that Android App Development is slated to prioritize Kotlin. The latest Jetpack APIs and new features will come up first in this programming language. The developers were advised by Google to write their codes in future on Kotlin.
But, what about Java that has long been the preferred language of app developers? How far does it change the app development scenario? And, of course, why at all did Google decide to make the switch?
Let’s find the answers to all these questions and more today.
The lawsuit that led to the search for a Java alternative
To clarify it at the onset, Google is not planning to get rid of Java completely. But, it almost looks like it wants to! Google has, for a long time, been looking for a better alternative to Java as a programming language for developing android apps. The writing has been there on the wall for a long time. It just became more real with the official announcement from Google.
It all started way back in 2010, when a lawsuit was filed against Google by the owner of Sun Microsystems, which had newly acquired Oracle. Sun Microsystems accused Google of copying the Java API for creating the Android operating system.
The legal battle raged for nine years, with several twists and turns along the way. Google’s defense in this situation was that the APIs were not under any copyright. However, Oracle kept on insisting that there was a copyright and Google had violated it by not licensing the API before going ahead and using it.
To sum up the situation, it is not like you will have to lose out on Android in case Oracle wins. Google has made sure that such a scenario never comes up by creating all the versions beginning from Android 7.0 (commonly known as Nougat) using Java Development Kit, which is an open source version of Java.
However, Google still wants to stay away from all these hassles. Java is almost like the universal programming language. The Android developers can dread it as much as they want, run as far away from it as they can, and still the benefits offered by Java ensures that it comes in handy in one way or another. Thus, Google had no other way than to find something which does not aim to swap Java completely, but rather acts as its alternative.
And, voila! There was Kotlin! This is a language that is as easy to use as Java, and is also interoperable along with it.
Reasons for Google to choose Kotlin over other options
With Kotlin, it was not like Google had come up with a completely new language. In fact, this programming language was developed back in the year 2011, but it failed to get its well-deserved recognition. JetBrains, the long-time development partner of Google, is the developer of this open source language.
In 2017, in the annual developer conference of Google (Google I/O), Kotlin was introduced as the official language for developing android apps, alongside C++ and Java. And, that was it! There was no more looking back for Kotlin.
This rise to fame of Kotlin was facilitated further by the fact that it had the much-needed support from the Integrated Development Environment. This was all thanks to JetBrains, the developers of not just Kotlin but also IntelliJ, the core Android Studio.
The support that Kotlin received both from JetBrains and Google made it easy for the Android App Developers to switch hassle-free from Java to Kotlin. It was not long before even the Android developers understood the multiple benefits held by Kotlin over its earlier counterpart, as far as app development is considered.
Read Also – Kotlin Coroutine Helps in Enhancing The Complexity Of Execution In App Development
The top benefits associated with the use of Kotlin
Truth be told, it was not all because of Google’s supports, and rather the use of Kotlin was facilitated by the numerous benefits that it offered for app development. Some of the five top benefits associated with Kotlin are as follows:
- Concise coding: Developers get to write very expressive, yet brief codes in Kotlin compared to the lengthy coding that comes with Java.
- NullPointerException: The NullPointerException has long being a big drawback of using Java for app development. Kotlin solved the problem by making the developers clearly declare variables as null and avoiding any such glitches.
- Ease of migration: It is usually difficult for the developers to start using a completely new programming language, more so because they have been using Java ever since they can remember. The conversion feature of Kotlin addressed this issue effectively, and let the developers convert their Java codes into Kotlin directly.
- Seamless integration: It takes less than ten minutes to work with Kotlin, even if you know nothing about the program. You will require a plugin if it’s Android 2.3, and if it is 3.0, then you will not need anything additional. Run it from IDE, debug easily, carry out refactors, and run instantly.
- Multiplatform approach: Kotlin came into being to help with JVM so basically Kotlin can be used on any device that runs JVM. So, its usefulness extends beyond writing only Android apps. You can also cary out front end developmental work using this programming language.
These major advantages and more led over half of the professional app developers to migrate to Kotlin, and welcome this change. At present, Kotlin has gathered quite the fan following among the Android developers. There is even a recent survey by Stack Overflow that proves Kotlin’s popularity beyond doubt.
So, the next big step for Android app developers is to take a Kotlin-first approach. It is understandable that everyone has not yet come up on the Kotlin bandwagon, but they should start the efforts to make the shift, given all the advantages that are in store for them.
It is okay if you are still working with Java and C++ because they are not going anywhere as of now. But, a new era of change is here, and it’s best to start embracing it gradually.