Developing Android messenger apps: Kotlin or Java?

Alex Gorodov
QuickBlox Engineering
4 min readJul 30, 2019

In the Java vs Kotlin case, we once again find the situation when something old, familiar and established meets its rival in the face of young, new and unknown. The market is experiencing rapid changes, and new languages are coming up with alarming frequency. Today, Java dominates in the world of Android development, but should it now make room for Kotlin? With all the attention to Kotlin, is it possible that it will become number 1 in android development?

The interest to Kotlin was sparked already in 2017 when Google named it the official supported language for Android app development. It flared again in 2019 after the annual Google I/O conference where this global technology whale declared the Kotlin-first approach in Android development. Google is actively encouraging developers to use Kotlin and suggesting that this language should be the top choice for new projects.

The community responded accordingly. In the Stack Overflow Developer Survey 2019, Kotlin ranks fourth in the rating of the most loved programming languages — 72.6% of the developers working with Kotlin want to continue with it in the future.

Image credit: Stackoverflow

It seems that the time has come to write Java off and move to Kotlin in Android app development, doesn’t it? Let’s look closer!

Java vs Kotlin — advantages and disadvantages

Let’s see where both languages shine and where each of them can show the maximum performance.

Advantages of Java

Despite the advance of Kotlin, Java remains a rather popular language. The same survey we referred to earlier shows that 41.1% of respondents currently work with Java thus placing it on the fifth rank in the rating of the most popular languages. And it is for a reason, as Java has a lot of advantages:

  • The number of specialists working on Java with Android is the overwhelming majority.
  • Extensive ecosystem. Over the years, Java has accumulated tons of open-source code that can be reused in app development.
  • Significant presence in Android development. Decades of domination have not been in vain, and Android is still largely dependent on Java.
  • Huge community. Java is still loved and used by many, and Java developers can always rely on community support.

Disadvantages of Java

For fairness’ sake, we need to show where Java lacks, too:

  • It requires writing more code that takes longer.
  • A very large and powerful language that causes a high threshold of entry.
  • Java isn’t as flexible as Kotlin.

Advantages of Kotlin

Kotlin has a lot to say in its favor. Being much younger than Java, it has already managed to prove its effectiveness, earn the respect of many Android developers, and even become Google’s language of choice. Let’s see what Kotlin has to offer:

  • Cost-effectiveness. Kotlin is open-source, thus, the costs for an Android app development project are lower.
  • Easiness to switch from Java. If you know Java already, changing to Kotlin will be relatively easy.
  • Fewer lines of code. Kotlin is rather concise that results in better performance.
  • Interoperability with Java. You can add code written in Kotlin to a Java app, and they will work next to each other.
  • Compatibility with Java tools. Kotlin is compatible with the Java Virtual Machine as well as with Java libraries.

Disadvantages of Kotlin

Nothing is perfect, and Kotlin is no exception. Since we want to choose wisely, we need to know the weak points of the new language, too:

  • Lack of learning resources.
  • Smaller developer community.
  • Not a large number of developers in the market that affects the cost of product development.

Now, what to choose — Java or Kotlin?

As it often happens, we at QuickBlox cannot give a definite answer to this question, as a lot depends on your particular situation. In general, Kotlin is a better choice for beginner developers as it is relatively easy to master. In terms of business, it’s easier and cheaper to find a high-skilled Java developer than a person with the same level of expertise in Kotlin.

If you have a big project on Java, most likely there is no use migrating it to Kotlin. Just consider the time and resources spent on it and you see the point. As a rule, smooth migration always means many steps, as well as extra time for different compatibility tests. And though Kotlin is made with Java interoperability in mind, there are always issues occurring unexpectedly that require much more time for their completion than it first looks like.

And if you have a new startup or a small project that need to be refreshed or you’re planning to refactor the code extensively or increase the app functionality heavily, then migration to Kotlin might be a sound idea.

Performance-wise, both Java and Kotlin show good results, thus there is little sense in switching from Java to Kotlin if you already have a working product. If, however, you are about to launch a new Android app project, we recommend that you consider Kotlin. Such a decision will be in line with Google’s Kotlin-first concept, and with Google quickly adapting its tools and frameworks to Kotlin, the development process will be more streamlined.

One thing is certain — Java is not going anywhere, and its huge community will be there to support you. Kotlin, on the other hand, has Google’s support and active promotion behind it which makes its prospects rather bright. In the right hands, both will build great apps, so the choice is yours.

--

--