Google I/O 2017 turned out to be a lot better than anticipated. It was a delight not just for the users but also for the developers due to the many exciting announcements made. The news about Android Go, Android O Beta, a new and improved Google Assistant and lots more are in store for us from Google this year. But if there is one announcement that developers cheered the most, it is the news of Android now officially supporting Kotlin. If you have already programmed in Kotlin, you would understand better the reason for all the excitement. If you are still with Java, now would be a great time to try out Kotlin. Java is definitely not bad, and it is definitely
not something that can be easily replaced. But there are numerous benefits that Kotlin delivers that make it a favorite choice for several developers.
It has been just over six years when JetBrains introduced Kotlin. But it has been widely recognized and implemented due to the many benefits it offers. Kotlin was not crafted to replace Java. It was only made to make Java better and to tackle its limitations. Drawing bits and pieces from other JVM languages came this brief and easy to adopt language which developers all over the world soon fell in love with.
You would now be getting Android Studio 3.0 bundled with Kotlin- why is that great?
“The billion dollar mistake” be gone:
If you are tired of handling NullPointerException in Java, Kotlin comes in as a relief. It has an innate ability to tackle this one main issue that every developer hates. The core Nullability system is pretty safe. Several system crashes, anomalies, vulnerabilities and errors have often be associated with Java’s null reference problems so much that it is popularly called the “billion dollar mistake”. In Android, building an app that never crashes is almost close to impossible and the null reference is cited as one of the main reasons for this.
This is inculcated by a simple addition in the language. A normal String variable would not be able to hold Null. The special type of Null variable here is String?
Calling Kotlin from Java and Java from Kotlin are both simple. It doesn’t end there. You can also convert your existing Java code into Kotlin. This interoperability is what makes the transition even simpler. So Android developers who are currently working on Java for their apps can instantly convert it to Kotlin and proceed with it. If you are comfortable writing any section only in Java and if you wish to change parts of the code to Kotlin, that is possible too.
Kotlin is very much similar to many other JVM languages and so incorporating it for your codes would be a simple task. Now, why would you do that? The length of the code is going to considerably shorten and yes, you would also be avoiding NullPointerException.
JetBrains has held a great reputation for the support it offers. The IDEs by JetBrains are quite popular. These are often considered to be better than other JVM based languages to a great extent. So soon after you install the Kotlin plugin you can be assured of a great backup.
Besides all the above benefits, Kotlin codes are brief. You get the error prompts during compilation and would not have to wait for runtime. The codes are simpler to read thanks to the Syntax. It makes it easier to interpret and find issues too.
What are the changes to be expected from JetBrains?
Kotlin, the open sourced language also has a teeming community that is overflowing with information. Join the Kotlin community on Slack and get all your questions answered. Google supporting Kotlin is not going to put an end to anything. It is not going to make all your existing Java codes go waste. JetBrains would be collaborating with the Android Studio team for the plugin. It would not affect Kotlin’s performance with other platforms. And it is not going to affect JetBrain’s support for iOS and Mac either. It only makes things easier and open up a larger scope for Android app developers.