Kotlin Programming Language Will Be Fully Supported by Android
Google’s Android team announced at the annual Google I/O keynote that Kotlin is now an official language for Android development and it will be available out of the box with Android Studio 3.0.
Built by JetBrains, Kotlin is a relatively young, but modern statically-typed multi-platform programming language that runs on the Java Virtual Machine. Although its first appearance happened in 2011 (Android developers were already able to use it through a plug-in), its popularity is certainly going to spike now that it will become the official app programming language for Android platform. I believe that Kotlin has a lot of potential and it will bring some great advantages to the Java community.
Why Kotlin Is Good
Interchangeability With Java
One of Kotlin’s greatest strengths is that you’ll be able to create a project template in Kotlin or convert Java code to Kotlin code. This will be really helpful, mainly to people that want to start developing using this language, but already have a lot of development work done in Java. And to make this feature even better, you won’t have to choose between Java or Kotlin, as you’ll be able to use both on the same project.
Kotlin Syntax, Null Safety and more
At first sight, this programming language looks like a more simple to read and write, thanks to its cleaner syntax. In comparison with Java, it is more modern and it has a lot of great features, like null-safety or smart casts that help developers to make more stable software with less effort.
It also reduces the amount of code needed. With the use of Data classes, for example, it’s not needed to add the equals()/hashCode() pair, which is not hard to add, as most IDE’s can generate it, but it can become harder to maintain when changing the class parameters, for example.
Another feature that really caught my attention was the Coroutines (still in experimental stage), as it makes a lot easier the development of asynchronous code, not needing callbacks or complicated flows, and it’s also more efficient than using threads.
Now I’ll show some snippets of Android code using Kotlin to demonstrate how it looks like.
Creating a Data class
I strongly suggest everyone to take a look at the presentation video of Kotlin with live coding happening at the Google I/O Keynote. If you find this topic interesting and you’re eager to learn more, you can find some good examples and documentation in the Android Developers or Kotlin web pages. But better than see it is to use it, so if you have a spare time to code, give Kotlin a chance.