Here are the reasons I think why to use Kotlin for Android Development, far from being a risky bet, is one of the best things you can do.
1. Google now supports Kotlin as a first-class language for writing Android Apps
Java and C ++ were the official languages of Android, but, from now on, the platform will also support Kotlin, a language much simpler and able to replace Java in the future.
Android and Google now support and drive the Kotlin programming language, developed by Jet Brains – the same developers of the Android Studio IDE. This new language runs on the JVM (Java Virtual Machine), the same machine on which Android applications run.
This language, like Java, is based on objects, but the syntax is much simpler, improving the reading and understanding of the code that developers write. This new language also includes some own characteristics that will be of great use for the development of applications, like better handling of the exceptions at runtime.
2. Language and environment are mature
Unlike other languages like Swift, the Kotlin release has gone through many stages of maturation before releasing the final version
This means that you will not encounter problems working with Kotlin, everything works as you would expect.
The IDE plugin works perfectly, and already allows many of the functionalities that exist for Java. Therefore, working with Kotlin is a marvel in that sense.
It is interesting to know that before going to production, the language spent several years in alpha and then in beta and that before the beta came out there were people who were using it in real projects.
3. It greatly facilitates the development of Android
Kotlin is simplicity mixed with power, so you have an open world of possibilities if you came from Java that you could not even imagine.
I honestly think it’s the only viable alternative to Java to develop great applications on Android. Other alternatives such as Scala are tremendously heavy, and compilation times and tools are not comparable.
The compilation in Kotlin today is already comparable to that of Java ( in some tests it has been shown to be even higher), and the library needed to use it is very small, so it does not generate problems with the limit of methods in Android.
4. It’s seamlessly integrated with Android Studio
It may sound silly, but it all works so well from the zero minutes for Android is a potential advantage.
You may have already seen it if you’ve tried it, but without knowing anything about Kotlin you can have a project set up and ready to work in less than 10 minutes without any problem.
And from there everything works just like if you were working with Java: you can run from the IDE, debug without problems, make refactors, use instant run … Everything you can imagine is already there and can be used.
5. Its evolution is well covered
IntelliJ is the company behind Kotlin, and she herself uses it for her own products, so they are more than interested in further developing it.
Also, specifically talking about Android, they are aware that it is their biggest market, and they are very focused on everything working perfectly on this platform.
From features like the Kotlin Android Extensions to libraries like Anko, to the constant optimizations of size and compilation times, it shows that they are convinced that Kotlin is the future of Android.
6. If you are an Android developer, you need to recycle
Let’s face it: working with Java 6 makes us obsolete programmers.
I did not notice much until I started learning Kotlin. But once you use modern language, your mind begins to think differently.
And this gets captured in your code even if you do not change the language. I now in Java solve things differently, just because I have learned concepts that I did not know thanks to study a language that supports them.
In addition, you become much more versatile. After this, I have observed (I have even used) some languages like Swift, Groovy, and Ruby … and I have been much easier the transition because all of them use very similar ideas.
Concepts such as lambdas, extension functions, functional operations on collections, sealed classes, data classes … with one name or another, you will find in almost all languages. So, you just need to map the conversion from one language to another in your head, and you can move with ease.
Although adores Android, being more prepared to make the leap to another language or another platform gives you a huge plus as a developer.
7. It’s much safer than Java
You cannot imagine how tired I am of the NullPointerException in Java. Actually, every time I see one It pisses me off because it is a major problem in the design of the language itself.
I do not deny that today we have tools like annotations or some design patterns, that can help us avoid much of it. But, as always, the amount of extra work needed is a problem in time and money.
But we can not only talk about nulls. The whole amount of code we save on Kotlin reverts to:
- Fewer errors: if there is less code, it is more difficult for that code to fail, and therefore becomes more stable.
- When the compiler helps you to detect those errors at compile time, they never come up at runtime (obvious).
- The code is easier to understand when someone else reads it and, again, it is more difficult to introduce errors.
- It is clearer what the code does (and not how it does), because we avoid any series of dissuasive structures that only serve to overcome the deficiencies of language.
In short, all this makes more work done in less time, more stable, and with less need to devote time to mistakes.
8. There are well-known companies that already use it in production
For example, Pinterest, they are already using it in the new features of their Android application. You can listen to Christina Lee talking about her experience when she starts using it on Pinterest.
On the other hand, we have Basecamp, where 70% of the code of their Android App is already written in Kotlin. Dan Kim Tweeted about this and Trello, is already using Kotlin code in production as well.
In short, on the Kotlin website, you can see a growing list of companies that are already using it without problems in production.
9. Companies start to consider it an interesting extra
It is not just that there are companies that already use it, but others are becoming very interested in it.
There are several companies that have enrolled their employees in the Kotlin courses, and others are interested in delivering it in their offices.
Companies are starting to invest money in training their employees in Kotlin, and that can only be a good sign.
10. When Its adoption increases, you will be the first
Being first in something is always a competitive advantage. When Kotlin becomes the language that all companies want to use for their Android developments, you’ll be the first to be in the loop.
I am convinced that the time will come when that happens, and having good strength in the language will make your position in the sector is much greater than that of someone who does not know.
11. Micro niches are very profitable
Even though Kotlin is not adopted in most companies yet, there are already some who are using it. And if those companies grow, they’re going to need experts on Kotlin.
There are people who master super strange languages that are almost unused, but who are earning a lot of money in the United States because they are one of the few language experts in the world.
12. It is 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 in Kotlin.
This is because Jetbrains people were very concerned that the transition from Java was simple, with a language that closely resembles what you already know.
And in very few, thanks to the simplicity of the language and to what the compiler helps you, you can handle the basics of the language without any problem.
From there, the only more complex part is to understand the concepts that Java lacks, rather than the Kotlin syntax itself.
I do not think anyone needs more than two weeks to feel comfortable writing code in Kotlin.
13. It’s so fun to use
Already to finish, and although this is very subjective, for me Kotlin is a lot of fun to use.
Java bores me every day more, with its limitations, its boilerplate, and errors due to its design problems …
However, Kotlin opens a new world of possibilities for you to be creative, and to solve problems in a very different way than you have done so far.
I have seen hours and hours in front of the computer looking for ways to simplify daily tasks in the development of Android, and enjoying a lot in the process.
Little more I have to say. I think it’s a very friendly language to start with, very funny, it opens up your mind and, above all, it is ready to be used in production.
If all this has convinced you, I encourage you to get hooked on the language. And if you really want to get deep into it, you should consider taking a course in Kotlin.