Short Bytes: At I/O 2017, Google announced that it’s adding Kotlin programming language’s support in Android. Kotlin, which solves many pain points of Java, has been gaining momentum in recent past. Apart from being open source and featuring full Java interoperability, other best features of Kotlin make it something a programming enthusiast must know.Keeping in mind the increasing demand for Kotlin programming language after the recent Google I/O, here is some interesting information that you’ll find useful:
Must know features of Kotlin programming language
1. Kotlin is open source
First and foremost, Kotlin in an open source programming language. This statically typed language was built by Jetbrains, who are also makers of IntelliJ IDE. Apart from being an open source programming language, Kotlin doesn’t ask much when it comes to converting existing Java code, it happens with a single-click tool. But, if you wish to learn Kotlin from the scratch, there’s great and cost-effective beginner course available on Udemy.
2. Full Java Interoperability
One of the best features of Kotlin programming language is its deep interoperability with Java, which is bound to attract more Java developers to learn Kotlin. It runs on the JVM and uses Java libraries and tools. It offers backward compatibility for Java versions 6 and 7.
3. Kotlin compiles to JVM bytecode or JS
4. Data Classes in Kotlin
The feature scope and necessity of a class is always argued by the programming language designers. A typical data class in Java has tons of boilerplate code one needs to skip while finding out the real use of that class. However, in Kotlin, you can write the equivalent of the same Java code in a very simple manner and save tons of typing and mental effort. It’s one of the best features of Kotin programming language.
5. Defaulted parameters
The defaulted parameters in Kotlin are pretty handy when you pass the arguments by name, instead of index. Their advantage is seen when there’s a function with tons of optional parameters.
6. Kotlin imposes no runtime overhead
The standard Kotlin library doesn’t have garbage, it’s tight and small. It has mostly focused extensions to the Java standard library. Many of its functions are inline-only that just become inline code. Kotlin has many optimizations which, specifically, help Android development.
7. Null Safety in Kotlin
Kotlin programming language’s type system aims at eliminating the perils of null references from code, which is often called The Billion Dollar Mistake. For example, in Java, accessing a member of null reference results in a null reference exception. Kotlin doesn’t compile code that assigns or returns a null. This is seen as one of the most important features of Kotlin.
8. Extension functions
Thanks to the extension functions in Kotlin, you can add methods to classes without making changes to their source code. Similar to Scala’s implicit methods, you can add methods on a per-user basis to classes. While extension functions are often controversial, every now and then it’s very useful.
9. Swift is like Kotlin
It’s a feature of Kotlin, but I came across this great link on Hacker News, so I’ll just leave it here to do all the talking: http://nilhcem.com/swift-is-like-kotlin/
10. Kotlin wants you to write less code
Unlike Java, which needs you to write everything, Kotlin compiler can understand from the code and write the remaining code, for example, it can infer types in variable declarations. This increases productivity and saves time.
Kotlin makes Android development more fun
If you search the web, you’ll find tons of ways in which Java’s pain points are solved by Kotlin and how features of Kotlin aim to make Android development more fun. You can use it write more expressive and effective code with fewer bugs.
If you’re looking to learn Kotlin and join the budding army of Android developers, you can try out this online course which is available at 89% discount.