Java vs. Kotlin: Improving Android Development

  • 05/07/2017

Java—along with Groovy and Scala—has been one of the primary programming languages for Android development for years. Much like Objective-C in iOS, Java was written decades before mobile development. While both are powerful, versatile languages, they are also verbose, and not optimized for mobile—which has driven the creation of new, mobile-first languages like Apple’s Swift.

Android’s answer to keeping up with the rapid pace of mobile development? The Kotlin programming language.

Here’s a quick look at how Kotlin is offering Android developers a more concise, readable language that lets them be more productive and write better mobile apps.


Inherent issues with Java became issues for Android programmers. Updates to fix these issues with the release of Java 8 have kept the language improving, but Android developers aren’t able to use Java 8 out of the box, and are somewhat stuck with Java 6. Even with workarounds, back-ports, and tools to overcome those hurdles, there are limitations with the language as a whole that’s created issues with Android API design, plus the pesky risks and errors of a verbose language that requires you to write more code.

In other words, there was room to improve.

The newer, lightweight Kotlin language was designed to advance existing Java paradigms, solve problems with API design flaws, and—even though it’s equally suited for enterprise back-end systems—make Android mobile development better.


Where Kotlin really takes off is tackling more inherent issues with Java. Kotlin has more than a few pros that improve Android development and app performance, including:

  • It’s Android-focused. Kotlin was written by the same folks who created popular integrated design environments (IDEs), so its background comes from mobile industry pros who were looking to solve specific problems.
  • Making the switch from Java is easy. In IntelliJ or Android Studio, converting Java files to Kotlin just requires installing the Kotlin plugin, adding it to the Gradle build files, and clicking convert.
  • Extension functions, which help in building really clean APIs and solve a bunch of other problems.
  • It has null in its type system. Nullability problems are common in Java, and Android uses null quite a bit to represent the absence of a value. Basically, having a null point exception can kill an app. Kotlin solves this by having null right in its type system, not forcing developers to use some kind of workaround.
  • It’s concise. Java isn’t known for being the most succinct language, and while that isn’t a con in and of itself, when you’re programming for Android and using a bunch of common idioms, verbose code can lead to more chances for bugs. When you’re able to write less code with a language that’s more concise, there are less opportunities for errors, and it’s less tedious for developers.
  • It’s versatile and interoperable with Java. Developers can write new modules in Kotlin that will work alongside existing Java code. It’s compatible with all existing Java libraries and frameworks, the JVM (Java Virtual Machine) and can integrate with the Gradle or Maven build systems. Whereas many languages are hardline functional or object-oriented, it’s not overly opinionated and doesn’t enforce one philosophy over another.
  • The Anko library and plenty of other Kotlin-based projects. The Anko library is a Kotlin source file that eliminates a few XML-related headaches, too. There are over 2000 Kotlin projects on Github, with everything from frameworks to build systems to libraries.
  • It avoids extra garbage collection, a common problem in Android development that adds inefficiency to Java code.

Source: Upwork