· 9 min read
12 reasons why you should start using Kotlin for Android today (KAD 30)
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.
[bctt tweet=“Here are my reasons why I think that moving to #Kotlin is one of the best things you can do.” username=“lime_cl”]
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.
[bctt tweet=“#Kotlin is a mature language, been through several years of alphas and betas until its final release.” username=“lime_cl”]
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.
[bctt tweet=“#Kotlin is simplicity mixed with power. You have a new world of possibilities if you’re coming from Java” username=“lime_cl”]
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.
[bctt tweet=“You can have a project set up and ready to work in less than 10 minutes in your first use of #Kotlin” username=“lime_cl”]
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.
From features like Kotlin Android Extensions, to libraries like Anko, continuous library size optimizations and build times, it all shows that Jetbrains is putting a lot of effort into Android.
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.
Aunque amamos Android, estar preparados para saltar a otro idioma o plataforma te da un gran valor como desarrollador.
[bctt tweet=“If you are an #AndroidDev, you need to recycle: Java 6 makes us obsolete programmers” username=“lime_cl”]
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), porque evitamos cualquier boilerplate que solo sirve para superar las carencias del lenguaje.
Definitely, it translates into more work done in less time, more stability, and less time spent in fixing bugs.
[bctt tweet=“#Kotlin features translate into more work done in less time, and less time spent in fixing bugs.” username=“lime_cl”]
7. There are well-known companies that already use it in production
For example, Pinterest is ya está usándolo en las nuevas características de su aplicación de Android. You can listen to Christina Lee talking about her experience when they started using it on Pinterest.
Another great example is Basecamp, donde el 100% del código de su aplicación de Android ya está escrito en Kotlin. Dan Kim wrote about it:
https://twitter.com/dankim/status/864951356792070144
You also can read about their experience in several articles: article 1 and article 2.
Or Trello, whose production code also includes some parts in Kotlin:
https://twitter.com/danlew42/status/809065097339564032
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.
But it doesn’t stop here, because thanks to Gradle support, you’ll be able to write your Gradle files in Kotlin, and thanks to Kotlin Native, the future is open to basically any platforms.
Writing Android Apps is just the tip of the iceberg.
[bctt tweet=“With #Kotlin, you can write #AndroidDev, server, frontend, Gradle scripts and even native Apps.” username=“lime_cl”]
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.
[bctt tweet=“An #AndroiDev can understand most of the code without ever having written a line of #Kotlin” username=“lime_cl”]
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.
[bctt tweet=“#Kotlin opens up a new world of possibilities for you to be creative in #AndroidDev” username=“lime_cl”]
Conclusion
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 learn what Kotlin’s situation is in the market, why you should learn it and the first steps to see how easy it is, I have prepared a free hour and a half training that you can join by clicking here.
Of course, I’ll continue writing more articles about Kotlin and Android, so keep in touch!