According to Stack Overflow Developer Survey 2018, Kotlin is the second most loved programming language and the fourth most wanted worldwide. Recently, TechBeacon included Kotlin in the list of 5 emerging languages with an excellent future.
Why is Kotlin getting so popular? Why do we use it in our work? Does Kotlin suit for enterprise mobile app development? Why should you choose it for building your Android application? In this article, we’ll answer these and other questions!
For some, it can be a little scary to start custom Android app development in a new language when there are no successful examples of its usage. Though Kotlin is very young, many companies have already written their applications in it.
Pinterest, a popular image-sharing social service, had decided to move away from Java almost once Kotlin first version was released, and presented advantages and disadvantages of using it in 2016, even before Google added an official support for this language.
Coursera, an educational company offering online courses of remarkable international universities, also chose Kotlin. Other examples of using Kotlin in the creation of famous products are Uber, Trello, Basecamp 3, Shadowsocks, Evernote, and Twidere for Twitter.
Kotlin was created to solve developer challenges of JetBrains company. They needed a simpler tool than Java to work with their main product, called IntelliJ IDEA, totally written in it. The guys investigated the alternatives, stayed unsatisfied, and decided to invent their own language.
The goal was to receive an effective tool that could be used together with Java in custom Android app development, work everywhere where Java can, and replace it if required. So, a big plus is that Kotlin came right from the developer community, not academia.
The development of Kotlin started in 2010. Six years later, in February 2016, we saw the appearance of the first Kotlin version – 1.0. In 2017, at Google I/O annual conference, Kotlin was announced as an official programming language for Android app development.
Noteworthy, that the technology was in alpha testing and then in beta – each for several years – and only then was moved to the production stage. That’s the main reason why everything works as you expect.) However, before the beta even came out, Kotlin programming language had been already used in some Android projects.
1. Laconism & expressiveness
When the size of a software project is becoming larger, the number of useless code pieces has to be increased just because the syntax of the language doesn’t imply other choices. Kotlin is so loved by developers, and we are not the exception, for its simplicity and expressiveness. It enables to implement various tasks much easier, quicker, and shorter, than the same in Java.
2. Compatibility with Java
Another advantage is that Kotlin programming language is fully compatible with Java. Kotlin developers have access to all Java frameworks and libraries while writing more clear and concise code.
So, Android engineers can use both languages when building a mobile product as well as migrate their applications from Java to Kotlin.
Even if you have a large Java-based project with millions of code lines, you can easily convert it to Kotlin one file at a time and you’ll see everything still successfully compiling. Here in BLAKIT IT Solutions, we write our code in Kotlin and use Java only for maintaining old projects.
3. Kotlin enables the multi-platform development
The founders added Gradle support so that Android engineers can write Gradle files in Kotlin. What’s more, they are actively developing Kotlin Native, which enables to build iOS applications, too. This way, you can write even native applications in this language.
4. Kotlin development provides more safety & less time for building apps
Kotlin founders integrated into the semantics the principles that prevent a wide range of common mistakes generally happening during the program execution. Another reason for Kotlin higher level safety (comparing to Java) lies in its advantages.
It enables the implementation of the same tasks with less time and effort. When the code is more simple and understandable, errors are more difficult to make and much easier to find, so the chances for them significantly decrease. You also reduce the time for mobile app development and bug fixing, which leads to reducing the overall mobile app development cost.
5. Adopting Kotlin is easy and low risk
Kotlin language has readable syntax, it is seamlessly integrated with Android Studio, easy-to-learn, and provides functional programming support. Other useful things and features include extension functions, null safety, better generies, operator overloading, and continuous library size optimizations.
If you want to facilitate the product maintenance or streamline custom Android app development, you can assign two or three engineers to move the project to Kotlin starting from a small part of the code base.
This way, you won’t disrupt the rest of the project while increasing the work efficiency due to spending less time on the development and bug fixing and having a more clear code.
There are a lot of things missed in Java and fulfilled in Kotlin: Lambda expressions + inline functions, smart casts, extension functions, companion objects, primary constructors, properties, and much more.
In speaking of the most useful features of Kotlin programming language, we asked the head of our Android development department Artem Korolchuk for his expert opinion:
Artem Korolchuk: Like many other Kotlin developers, I believe that the most remarkable features are the following:
Artem Korolchuk: Unfortunately, Android doesn’t support the ability to use the latest Java versions with all the improvements.
But even if it were possible, Kotlin is the latest-generation language that absorbed a bunch of cool things from other languages. The Kotlin developers have never made a secret of it. Instead, they directly say which features from which languages were borrowed.
Custom Android app development in Kotlin is much more pleasant and convenient. The code becomes cleaner and shorter – with no long heavy constructions. If you wish, you can implement an extension and see how beautiful everything turns out when the conventional 10 lines of Java code turn into 2-3 on Kotlin, while the code readability only increases.
Also, one of the decisive factors of moving away from Java was low risk in adopting Kotlin: you can do it step-by-step as Kotlin is fully compatible with Java and you don’t have to immediately rewrite the entire application.
Many companies are afraid to switch to Kotlin because of possible unforeseen situations and lack of experience. But due to full compatibility with Java, the transition to this wonderful language can be almost painless.
On September 13, 2018, JetBrains announced the release of Kotlin version 1.2.70, representing a bugfix and tooling update for Kotlin 1.2. In this version, developers introduced the following things:
This Kotlin v.1.2.70 also provides compatibility with Android Studio 3.1, 3.2 RC, 3.3 Canary, and all versions of IntelliJ IDEA from 2017.3 to 2018.3.
Just a week ago, we saw the release of Kotlin 1.2.71 that involved improvements to the IDE and other fixes and improvements from the previous version.
If you have some questions about the article, Android development, or have a project idea, contact us and get your free quote! Specializing in building Kotlin applications, we’ll be glad to help you!
We speak English and Russian