Lots of amazing companies, such as Netflix, Lyft, and Pinterest have embraced Kotlin in their tech stacks. And ever since Google announced official support for Kotlin for Android development in 2017, there has been a huge surge in interest in the language.
But why should developers learn Kotlin? In this article, we'll take a look at Kotlin's benefits and explain why you should consider adding it to your skillset.
1. Kotlin makes development a lot faster
Kotlin requires fewer lines of code to do the same thing as other programming languages, such as Java. Because it's an inherently concise language it can solve many common development problems with just a few lines of code.
For example, you can filter a list by just using a lambda expression like this:
val evenNumbers = list.filter { it % 2 == 0 }
And if you want a singleton, you simply create an object with:
object SingletonObject {
val userName: String = "SmallApe"
}
2. You can use it with existing java code
Kotlin is fully interoperable with Java, so apps you've already build can easily be migrated to Kotlin incrementally. You don't need to stop using Java, you can use both!
You can even add functionality to existing classes (even Java classes) by using extensions. This means you can take advantage of Kotlin's powerful features without having to abandon all the skills you've gained while building existing apps with Java.
3. Kotlin is officially supported by Google for Android development
Google announced official support for Kotlin at Google I/O in May 2017, saying:
Kotlin is a brilliantly designed, mature language that we believe will make Android development faster and more fun. It has already been adopted by several major developers — Expedia, Flipboard, Pinterest, Square, and others — for their production apps. Kotlin also plays well with the Java programming language; the effortless interoperation between the two languages has been a large part of Kotlin's appeal.
Just two years later Google announced that Android development will be Kotlin-first. Google hasn't officially said it, but it sure seems like Kotlin is now their recommended Android programming language
4. Kotlin has a large community and great resources
Anyone who ever used Java will find Kotlin's functionality very recognizable, so learning Kotlin is really straightforward. There are great resources available to quickly learn basic syntax and more advanced topics.
The language reference and Kotlin Koans (interactive exersices designed to help developers become familiar with Kotlin) are great ways to get started.
The Kotlin developer community is a great resource for expanding your knowledge and is growing rapidly. The Kotlin Slack channel is particularly active and is regularly recommended by new developers.
5. You'll improve the quality of the apps you build
Kotlin improves the quality of your released apps through "safety" features that have been designed to reduce the number of bugs and system failures.
For example, it has a strong type system based on null-safety. This means
by default, variables can't be null, so you can catch more errors at compile-time before shipping to users.
This is really useful. Null references were famously called "billion-dollar
mistake" by their inventor, Tony Hoare. This is because of the innumerable computer errors and system crashes they
have caused since their inception in 1965.
The professional and business benefits of learning Kotlin are compelling. It improves developer’s productivity, makes debugging easier, and increases the pace of app development. It's easy to learn and can be used within existing apps because of its interoperability with Java. These benefits help explain why it's such a hit with developers.