We’ve reached the end! The rest of articles were very practical, but today I wanted to talk about why I think it’s very interesting to learn Kotlin.
Even now that Kotlin is an officially supported language to write Android Apps, you may still feel that there are not enough reasons for a change. Java has proved to be working during all these years, so why should you change?
Here are my reasons why I think that, far from being a risky bet, moving to Kotlin is one of the best things you can do.Here are my reasons why I think that moving to #Kotlin is one of the best things you can do. Click To Tweet
1. Language and environment are mature
Unlike other languages like Swift, the Kotlin release has gone through many stages before releasing the final 1.0 release.
This means that there are hardly any problems when working with Kotlin, everything works as you would expect.
The IDE plugin works smoothly, and already allows many of the features that you love and use in Java. Therefore, working with Kotlin is awesome in that sense.
It’s interesting to know that before its final version, the language spent several years in alpha and then in beta. And that even before the beta came out, there were people using it in real projects.#Kotlin is a mature language, been through several years of alphas and betas until its final release. Click To Tweet
2. It makes Android development much easier
If you’ve been reading this series of articles about Kotlin, you’ve probably seen it crystal clear many times.
Kotlin is simplicity mixed with power, so you have an new world of possibilities if you’re coming from Java that you couldn’t even imagine.
I honestly think it’s the only viable alternative to Java for developing great apps on Android. Other alternatives such as Scala are tremendously heavy, and compilation times and tools can’t be compared.
Compilation times in Kotlin today are already similar to Java (in some tests it showed to be even faster), and the library required to write Kotlin Apps is very small, so it won’t increase your method count that much.#Kotlin is simplicity mixed with power. You have a new world of possibilities if you're coming from Java Click To Tweet
3. It’s seamlessly integrated with Android Studio
It may sound silly, but everything working so nice since first minute is a great advantage.
You’ve already seen it if you’ve tried, but you can have a Kotlin project set up and ready to work in less than 10 minutes without any problems, even if you don’t know anything about Kotlin.You can have a project set up and ready to work in less than 10 minutes in your first use of #Kotlin Click To Tweet
With Android 2.3 you just need to install a plugin, and in 3.0 the whole process will be seamlessly integrated.
And from there everything works just like if you were working with Java: you can run from the IDE, debug without issues, do refactors, use instant run … Everything you can imagine is still there and can be used.
4. Its evolution is well covered
Jetbrains is the company behind Kotlin, and they are using it themselves in their own projects, so they’re more than interested in further developing it.
Also, specifically talking about Android, now with Google support, we have two huge companies working together to bring the best language and tools to our development environment.
5. If you’re an Android developer, you need to recycle
Let’s face it: Working with Java 6 makes us obsolete programmers.
I didn’t realize until I started learning Kotlin. But once you use a modern language, your mind starts to think in a different way.
And this new knowledge shows in your code even if you don’t change the language. Now in Java, I solve things differently, just because I’ve learned concepts that I didn’t know before thanks to learning a language that supports them.
In addition you become much more versatile. After that, I’ve taken a look (and even used) some languages like Swift, Groovy, Ruby… and it’s been much easier to understand them because they all use very similar ideas.
Concepts such as lambdas, extension functions, functional operations on collections, sealed classes, data classes… maybe with different names, but you’ll find them in most modern languages. So you just need to map the conversion from one language to another in your head, and you can move with ease.
Although we love Android, being prepared to jump to another language or platform gives you a huge value as a developer.If you are an #AndroidDev, you need to recycle: Java 6 makes us obsolete programmers Click To Tweet
6. It’s much safer than Java
You can’t imagine how tired I am of NullPointerException in Java. Actually every time I see one I feel really frustrated, because it’s a major problem in the design of the language itself.
I won’t deny that today we have tools like annotations, or some design patterns, that can help us avoid part of them. But, as usual, the amount of extra work needed is a problem in time and money.
But we can’t only talk about nulls. The whole amount of code we save on Kotlin reverts to:
- Less errors: If there is less code, it’s more difficult for that code to fail, and therefore becomes more stable.
- When the compiler helps you detect those errors at compile time, they never happen on runtime (obvious but true 😄)
- The code is easier to understand when someone else reads it and, again, it’s more difficult to introduce errors.
- It’s clearer what the code does (and not how), because we avoid any boilerplate that only serve to overcome the lacks of the language.
Definitely, it translates into more work done in less time, more stability, and less time spent in fixing bugs.#Kotlin features translate into more work done in less time, and less time spent in fixing bugs. Click To Tweet
7. There are well-known companies that already use it in production
— Dan Kim (@dankim) May 17, 2017
Or Trello, whose production code also includes some parts in Kotlin:
— Dan Lew (@danlew42) December 14, 2016
On the Kotlin website you can see a growing list of companies that are already using it in production without hassle.
8. Companies are starting to ask for it on their job offers
It’s not just that there are companies that already use it, but others are starting to be interested a lot for it. I’ve already been training some big companies here in Spain, and the interest keeps growing.
Businesses are starting to invest money in training their employees in Kotlin, and that can only be a good sign.
9. Kotlin is multi-platform
Yeah, you’re not learning Kotlin just to write Android Apps. Kotlin was first created with JVM in mind, so it can virtually be used on any devices that can run the JVM.
But in Kotlin 1.1, Kotlin JS (which was experimental until then) was finally released, so you can also do front-end development using Kotlin.
Writing Android Apps is just the tip of the iceberg.With #Kotlin, you can write #AndroidDev, server, frontend, Gradle scripts and even native Apps. Click To Tweet
10. Micro-niches are very profitable
Even though Kotlin isn’t adopted in most companies, there are already some who are using it. And if those companies grow, they’ll need Kotlin experts.
There are people who master super strange languages that are almost unused, but thanks to that they are earning a lot of money because they are one of the few language experts in the world.
Kotlin will stop being a micro-niche soon after Google announcement, but there’s still some time for you to stand out.
11. It’s very easy to learn
One of the great advantages of Kotlin is that a Java developer can understand most of the code without ever having written a line of Kotlin.
This is because Jetbrains people were very concerned that the transition from Java was simple, with a language that closely resembles to what you already know.
Thanks to the simplicity of the language and the help of the IDE and the compiler, you can handle the basics of the language really fast.
From there, the only more complex part is to understand the concepts that Java lacks, rather than the Kotlin syntax itself.
I don’t think anyone needs more than two weeks to feel comfortable writing code in Kotlin.An #AndroiDev can understand most of the code without ever having written a line of #Kotlin Click To Tweet
12. It’s so fun to use
To conclude, and although this is very subjective, I find Kotlin really fun to use.
Java bores me more and more, because of its feature limitations, its boilerplate, errors due to its design problems…
However Kotlin opens up a new world of possibilities for you to be creative, to solve same problems in a very different way.
I’ve found myself hours in front of the computer looking for ways to simplify daily tasks in Android development, and enjoying a lot in the process.
#Kotlin opens up a new world of possibilities for you to be creative in #AndroidDev Click To Tweet
In my opinion, Kotlin is a friendly language to start with, really funny, it will spread your mind and make you think different and, above all, it’s ready to be used in production.
And it’s now an official language for Android development!
This is the end of the 30 articles I planned as an introduction to Kotlin for Android Developers, that I’ve been publishing for the last 7 months.
A lot of things have changed since then (the release of Kotlin 1.1 and Google announcement among others), and I hope they become a great tool for people to start learning Kotlin and boost the initial learning curve.
But if you want to go even faster and learn by example, I recommend you to get the book: Kotlin for Android Developers, where you’ll learn how to create a complete App from scratch while learning Kotlin in the process.
Of course, I’ll continue writing more articles about Kotlin and Android, so keep in touch!
Author: Antonio Leiva
I’m in love with Kotlin. I’ve been learning about it for a couple of years, applying it to Android and digesting all this knowledge so that you can learn it with no effort.