Should You Migrate Your Android App from Java to Kotlin?

Photo of John Waldron

John Waldron

Dec 29, 2017 • 8 min read
ash-edmonds-510566-unsplash-727887-edited

In May 2017, the Android team at Google announced first-class support for Kotlin, a statically typed programming language that runs on the Java Virtual Machine (JVM).

Kotlin is built by JetBrains, who (it is worth noting) is also responsible for developing the JetBrains IntelliJ Java IDE, which Google’s own Android Studio is based on.

Kotlin has been widely regarded as the primary alternative to Java (the default language for Android development) for a while. But now, with Google’s official support for this nascent language – Kotlin tools are included with Android Studio 3.0 by default – Android mobile app owners have lots of reasons to be excited, because many new enhancements are being introduced and opportunities are opening up.

Completely Interoperable with Java

There is a lot of buzz and excitement about Kotlin, and with so much talk and anticipation, entrepreneurs with apps for Android written in Java may think that Java is being phased out. Well, this certainly isn’t true for the moment. Google has been careful to note that Kotlin is an additional language, not a replacement for its existing Java (and C++) support.

Kotlin is 100-percent interoperable with Java, and the two languages have a lot of similarities in their structures. Both are object-oriented and statically typed, and Kotlin has been designed to solve similar problems to the ones that Java solves.

However, Kotlin is a truly modern and powerful language with a much cleaner syntax, and helps to solve common headaches such as source code verbosity and runtime exceptions.

Working side-by-side with Java on Android, you can add Kotlin code to your existing projects, and can call Java code from Kotlin and vice versa. This means that Kotlin can be gradually introduced into your assets, and that all of your existing technology investments – and indeed your skills – are completely preserved.

Android Studio 3.0 now ships with Kotlin straight out of the box – and with both JetBrains and Google supporting Android development in Kotlin (both companies are working on a non-profit foundation to look after the language), app owners and developers no longer need to worry about the compatibility nor fuss around installing any extras.

The Benefits of Migrating an Android App from Java to Kotlin

Kotlin already enjoys wide usage. Companies such as Google, Kickstarter, Pinterest, Square, and Trello (to name just a few) are all over Kotlin, so even if you haven’t heard of it, you will almost certainly be using some fantastic apps that make use of the technology.

Kotlin is a concise language. It drastically reduces the amount of boilerplate code required, which means that not only does it enhance productivity, but with less room for error, it produces safer, more reliable code.

And this is great news from a business perspective – the more you can enhance the stability of your Android apps through weeding out bugs and minimising crashes, the better the user experience (UX) will be.

Kotlin has been designed to be fail-fast whenever possible. In addition to speeding up development time, this also greatly facilitates searching for bugs and even preventing their occurrence in the first place, vastly reducing the cost and effort required to fix errors.

Developers are also extremely enthusiastic about Kotlin. In fact, when the support for Kotlin was announced at Google I/O 2017, it enjoyed what was probably the loudest applause of the whole event. According to a recent RebelLab survey of more than 2,000 Java developers, Kotlin proved to be the technology that they’re most excited about using, and the one that they’re most satisfied with as well.

12-The-lesser-used-language-are-loved-more

Image source: zeroturnaround.com

This really is a huge accolade – the coder’s code of choice. Kotlin’s ease of use makes it a firm favourite amongst developers, and, combined with Google’s official support, adopting Kotlin could be a big step towards helping your engineers become more satisfied, happy, and engaged in their day-to-day work.

Should You Migrate from Java to Kotlin?

Kotlin is awesome, and there is no denying that. However, making a complete migration from Java to Kotlin at your company is no small task and will require sufficient training and planning. Of course, because Kotlin is 100-percent interoperable with Java, there’s no need to migrate all your stuff in one go. The switch can be as gradual as it needs to be.

Even so, there are few things that you need to take into consideration before you commit to a full switch. For starters, due to the lack of experience with this relatively new language, it’s possible that bugs might be introduced in your Android app’s code. As such, investments in training and time will be required if you decide to move your Android development team to Kotlin. That said, the great news is that learning Kotlin is a pleasure, and isn’t too difficult for those already familiar with Java.

However, it must be noted that even though Kotlin adoption is growing rapidly, the Kotlin community is much smaller when compared to Java. This means that learning resources are limited in comparison, which could make it harder for your team to find the answers they need should they run into a problem. Still, Kotlin is gaining in popularity all the time, and the community is getting stronger and stronger even as you are reading this.

Final Thoughts

If you’re thinking about migrating from Java to Kotlin, a great way of starting the process would be to introduce Kotlin only in non-business-critical code to give your developers a chance to perform an initial evaluation and get to grips with Kotlin by using a few test cases.

Kotlin is making a big impact, and with Google’s support and several big brands having already converted, your developers will inevitably encounter the language sooner or later. This means that as a business owner, you might want to at least invest in training that will up-skill your developers and help them become well-versed in Kotlin. Gaining knowledge in this exciting technology will give them a wealth of opportunities to experiment with modern programming and will elevate your Android apps to the next level.

Are you excited about Kotlin and the opportunities it opens up? Let us know what you think in the comments below. Thanks for reading!

Photo of John Waldron

More posts by this author

John Waldron

John Waldron is a technology and business writer for markITwrite digital content agency, based in...

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by:

  • Vector-5
  • Babbel logo
  • Merc logo
  • Ikea logo
  • Volkswagen logo
  • UBS_Home