Never fear, Kotlin is here!

So, Google I/O just ended. And like every year, it showed great promises and awesome stuff.
One of the biggest announcement was the introduction of Kotlin as an Official Language for Android. This announcement received the biggest applause from the audience at the I/O. It was really a reason to be happy! Now we have Three languages we can use while making Android Apps.

  • Java
  • C++ with the Android NDK. And now
  • Kotlin!
“It is a brilliantly designed mature language that can make Android Development Faster and more fun”

Kotlin is a statically typed programming language. As Google describes it, it’s a brilliantly designed language, and will make Android development faster and more fun. Kotlin is compiled to JVM bytecode, so you can not only use it for your android projects, but also, any java projects you want. Classes written in Java are accessible in Kotlin without any additional code or wrapper, and vice-versa! This interoperation is a huge part of Kotlin’s appeal to the Android Team, and personally to me as well!

There’s a lot more going on for Kotlin!

Kotlin, an open source project under the Apache 2.0 license (No repercussions of a stupid Lawsuit over 3 lines of code!), is developed by the awesome people over at JetBrains, The same people who created IntelliJ IDEA, the base of Android Studio, and a solid all round IDE in itself. Google also announced that it will be partnering with JetBrains to move Kotlin to a non profit foundation.

There’s one more awesome thing! And this one matters, a lot!

Currently Kotlin’s prime runtime environment is the JVM(or the DVM in Android). But it can compile to JavaScript as well. And soon, Kotlin will compile to Native Machine Code (Object Oriented Desktop App development without the disgrace that is C++! Yay!) and with Native, you’ll be able to work with iOS or macOS as well!

Reasons to Consider Kotlin as your prime Language

If you’re still not convinced of the potential and awesomeness of Kotlin, let me give you a feature analysis of the language. But! before that, we all know that language is just another tool. Any language can be picked up if you understand the programming concepts. So Why Kotlin? Let’s start with a few major points which are industry oriented.

Kotlin Multiplatform
Kotlin can be compiled to both Java as well as Javascript code!

As I said before, Kotlin compiles to JVM bytecode and JavaScript. It is of greatest interest to people who work
Java or basically any environment with a garbage collected runtime.
Consider a use-case from Silicon Valley (the HBO show, not the place). The protagonists made a
“middle-out” compression algorithm, and had to spend a lot of time and resources writing it for different
But! With Kotlin, you can write all your awesome algorithms once, compile them to the required platform, Android/JS/Native and profit!
Time Saved = Money Saved!

Minimal migration costs

Kotlin is free! I don’t mean other languages need to be paid a royalty(Some do ;)). What I mean is, if you’re using IntelliJ, you can convert your Java code to Kotlin with one click!. There’s code conversions available for other languages as well, but this one is extremely polished and works offline! So you know that your proprietary Algorithm is safe and sound :)

Here’s some Java code:

In IntelliJ IDEA, I went to Code > “Convert Java File to Kotlin File”.
And the result:

That was it. I pressed the run button, and voila! Same result as before, error free conversion


As I mentioned Before, Classes created with Kotlin can be accessed in Java and Vice-versa. Hence, you can use all those awesome libraries you like in your .kt code with no conversion required! Not just that, on your existing
projects, you can start coding in Kotlin and migrate slowly and easily, with zero problems! Even those which rely on annotation processing. No need for wrappers or adapters and the likes, just include the library using Maven/Gradle or other build systems as you would for java, and have fun!

Easy to learn

If you’ve been using Java, learning Kotlin comes almost naturally. A simple read of the language reference and you’ll know what’s happening instantaneously.

Almost zero runtime overhead

The standard library of the language is small and to the point. It is focused on extending on to Java Standard Library, making it better and easier to use. There’s a heavy use of compile-time inlining, which results in faster code
and lighter stack.

With this out of the way, let’s now move on to the second important aspect

Syntactical language features

Kotlin has one great thing going for it. The makers keep it in mind that Productivity is more than just readable syntax. With that in mind, let’s dive into the amazing features which makes programming fun again

Null Safety Checks
Kotlin’s type system eliminates the danger of null references. This results in us getting probable NullPointerException errors at compile time itself. So we can manage them gracefully instead of a bunch of try-catch and Random Crashes.
Lean Syntax
Kotlin’s type inference works everywhere. a complete class can be generated in a single line. Real properties generate getters and setters at compile time for Java use. Functions can be declared outside of classes, so we don’t have to create a child class ClassB just to add that add function to ClassA.
Less and Less Boilerplate
Adding the data annotation to a class automatically creates the boilerplate code for equals, hashCode, toString, copy. Even the inner variables can be made in a single line, with default values if necessary so you don’t even have to write long constructors.
Operator overloading
This is the one feature I liked about C++ and miss in Java. Kotlin has special method names for overloading, so overriding their behaviour is easy, but you can’t define entirely define new ones. Balance between power and readability.
String interpolation
Kotlin can do this: my name is ${dude.firstName}
No more lengthy format() functions.
That’s right! It is possible to use Kotlin as a scripting language as well.
You can use -script flag with the kotlinc command line compiler and run your scripts for fun!

That’s all for now! I hope I gave you enough to try and use Kotlin. I’ll do a small Kotlin v Java syntax difference soon.

Until then, have a look at these Kotlin resources :)

Like what you read? Give Aditya Aggarwal a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.