DEV Community

Cover image for Features of Kotlin
Jay Tillu😎
Jay Tillu😎

Posted on • Updated on

Features of Kotlin

Kotlin provides you some amazing and powerful features over Java. That’s why developers love Kotlin. There are many tech giants who use Kotlin before Google announces the official support for it.

Following are seven main features of Kotlin:

  1. Concise code
  2. Null safety
  3. Expressive code
  4. Modern features
  5. Interoperability with Java
  6. JavaScript transpilation
  7. Native conversion (Kotlin Native)

Concise code


Developers always love clean and concise code. Less code takes less time to write, less time to read, and also makes easy to maintain it.

Kotlin has really concise code compare to java. It drastically reduces the amount of boilerplate code. So compare to java you will write less amount of code in Kotlin, which increases the speed of your development.

Rough estimates indicate that Kotlin requires 40% less line of codes compare to java.

Null Safety


More than 70% android app crashes due to null pointer exception of java. Java does not provide any ways of protection against the null. The developer has to handle it on his/her own.

But Kotlin handles nulls really nicely. In Kotlin you cannot get null pointer exception implicitly. Kotlin compiler by default doesn’t allow any types to have a value of null at compile time. So if you use Kotlin then it will reduce your app crashes and gives better user experience to your user.

Expressive code


Expressive code means the code that can be easily understandable by every programmer.

Kotlin is really expressive. All data types, built-in functions, keywords, etc. are really very expressive and easily understandable. Kotlin is designed in such a way so that even a person who never codes in kotlin can easily understand its code.

Modern features


As kotlin is a fourth generation language, it introduces and combined a lot of new features like Lambda functions, smart casts, null safety, operator overloading, etc. Which will help you in increasing your productivity? Kotlin is influenced by six major languages and it inherits a lot of best features of them.

Interoperability with java


Kotlin is 100% interoperable with java. You can easily call Kotlin code from Java and Java code from Kotlin. This makes adoption much easier and lower-risk. There’s also an automated Java-to-Kotlin converter built into the IDE that simplifies migration of existing code. This makes easy to work on an existing Android project. You can keep your old java file as it is and create new features in the new kotlin file.

JavaScript transpilation


You can transcompile your kotlin code to JavaScript code. That way even your kotlin code can run on browsers. When you choose the JavaScript target, any Kotlin code that is part of the project as well as the standard library that ships with Kotlin is transpiled to JavaScript. However, this excludes the JDK and any JVM or Java framework or library used. Any file that is not Kotlin will be ignored during compilation.

According to official documentation, the current implementation targets ECMAScript 5.1 but there are plans to eventually target ECMAScript 2015 as well.

The Kotlin compiler tries to comply with the following goals:

  • Provide output that is optimal in size
  • Provide output that is readable JavaScript
  • Provide interoperability with existing module systems
  • Provide the same functionality in the standard library whether targeting JavaScript or the JVM (to the largest possible degree).

Native conversion (Kotlin Native) (Beta)



Kotlin Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine. That way your kotlin code will directly run on a system without any additional runtime or virtual machine.

Note that kotlin native is still in beta (as of 12-July-2019)

Targeted platforms
Kotlin Native supports the following platforms:

  • iOS (arm32, arm64, emulator x86_64)
  • MacOS (x86_64)
  • Android (arm32, arm64)
  • Windows (mingw x86_64)
  • Linux (x86_64, arm32, MIPS, MIPS little endian)
  • WebAssembly (wasm32)

So guys above are major features of kotlin. Let me know in the comments if I miss your favorite one.

Please check every day for new posts on Kotlin and other programming topics. Till then Keep Coding, Keep Loving.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

Latest comments (0)