In the world of Android app development, Java had already established itself as a battle-hardened language that has died a number of times only to be resurrected as many times. But then came the sunny morning of May 17, 2017, and the story changed — bringing Java on a path of decline. That was the day of the 2017 Google I/O Developer Conference where the tech giant announced Kotlin as an official programming language for the Android mobile platform.
This thus-far unpopular programming language that was brought into existence by JetBrains in 2011. However, it suddenly burst onto the scene with this announcement when it became the preferred language of not just Google but also of organizations like Uber, Evernote, Coursera, and Pinterest, among others.
The rate of adoption that spiked then hasn’t gone down even at the present date. The more businesses are exploring the language, the more they are becoming its evangelists.
There are some very real, striking benefits that the language offers over Java and they are exactly what we will be discussing in this article. We will be looking at the reasons why Google chose Kotlin as its official programming language and try to find out if the time for developers to bid adieu to Java has really come.
Without further ado, let’s straightaway get to the reasons behind Google’s choice.
Kotlin has been conceived with the idea of becoming completely interoperable with Java. This means Android app developers can make use of a number of Java libraries for writing code in Kotlin and can generate Java code from Kotlin with the help of converters offered by the language’s developer company JetBrains. What this means for organizations is that they can reuse their existing talent by training developers on Kotlin rather than having to hire a completely new team to develop in Kotlin. This resource utilization is a big considering for enterprises that rely on hundreds or Java developers even today.
One of the biggest problems that developers face while working with Java is that when they access a part of the null reference, they get null reference exception. Kotlin is aimed at eradicating the NullPointerException from the code thus lowering the chances of mobile apps crashing mid-operation.
By supporting inline functions, Kotlin is able to increase the execution speed of Lambda functions. Also, since the language has a compact runtime library, the methods added at runtime are a lot less than Java, which enables the apps to run faster on users’ devices.
The fact that a class written in the new Google official language is a lot more compact and concise than Java is one of the prime reasons behind the growing popularity and acceptance of the language. Because the class is compact, the amount of code to be written in Kotlin is also a lot less than Java.
And as any developer would know, less code equates to fewer bugs, quicker development time, and ultimately lower development costs. These are the ripple benefits of Kotlin being a modern alternative to Java.
Android app developers are able to write code more efficiently with Kotlin because of the presence of robust IDEs as compared to Java.
Kotlin components like Anko and Android extensions that make it possible for developers to replace the findViewById() function help developers write code that is a lot more cleaner and readable.
Kotlin is powered by features that not just make the Android app developers’ lives easier but also betters the overall user experience. Has the time come for the world to move from Java? Is Java now officially on the track of becoming an obsolete programming language?
Well, not so soon. If anything, the community of Android app developers believes that the future of the two programming languages lies in growing together and not in one supplanting the other.
Even if you look at the present-day scenario, while it is true that Kotlin has managed to find itself a follower base of thousands of Android app developers and has been accepted and adopted by a range of different businesses across industries, there are a number of areas where Kotlin still lags behind Java.
Kotlin comes attached with a bigger runtime size compared to Java. Plus, the standard library that the language has increases the size of .apk as well. This means that while Kotlin can support an app size of up to 800KB, the moment this size increases, the app becomes heavy. This is contrary to the trend of lightweight microservice applications that’s become the norm today.
Since the code written in Kotlin is lesser than the same code written in Java, it can be a challenge for intermediate-level Android app developers who may prefer verbose code.
The number of Java developers is a lot more when compared to those using Kotlin. Because of its maturity, Java has the support of video tutorials, blogs, and articles, which is still not in abundance in case of Kotlin.
When it comes to the development of complex apps, the scale of coding that would be needed is something that Java can support a lot better than Kotlin.
As said above, both Kotlin and Java come with their share of strengths and limitations. In a scenario like this, how do you — a business — decide which language to choose from between Kotlin and Java for Android app development?
In short, if your developers are midway or further in with the project, do not make them switch to Kotlin. In case they are just starting up, it’s safer to go with the trend and take the Kotlin route.
While the growth trend (in terms of the acceptance rate) that Kotlin has shown is rarely seen in any of the programming languages, we cannot ignore the fact that the language also comes with its share of shortcomings.
So, the answer to “which language to choose” would depend entirely on the stage at which your project is and the experience level of your team of developers. If your team’s Java knowledge is sound, they would not have problems with making a switch to Kotlin, but in case they are at the intermediate level, it would be better for them to stick with Java.
In this tutorial, we are going to use an Azure Automation Account to create a report of all VMs per…
Istio and Consul have their pros and cons, but both service meshes are equally important in the big picture of…
IBM Cloud Pak for Security lets users connect with any security tool, cloud, or on-premises system, without the need to…
Managed Service Providers are in the crosshairs of hackers because the bad guys know MSPs hold a lot of sensitive…
Here’s a Quick Tip that will show you how to link an Azure Automation and Log Analytics workspace even if…