Kotlin: 10 reasons of gaining popularity among Android Developers

Md. Tanvir Hossain
Oceanize Lab Geeks
Published in
4 min readOct 31, 2017

In this article first i am going to introduce kotlin and then 10 reasons for its gaining popularity among android developers.

Introduction:kotlin

Using Kotlin for Android development has grown in popularity over the last year. Even to those who are not currently using it, the value proposition of the language immediately increases, adding simplicity and power to existing paradigms of Java development. Kotlin is a language by the company JetBrains. They are developers of IDEs for tons of different languages, the Intelli J platform, which is the basis for Android Studio. On their website, they describe Kotlin as:

Statically typed programming language for the JVM, Android and the browser.

It targets the JVM and Android and Java 6 bytecodes. They want to add these new features in the language, while still supporting these markets of the Java 6 and up JVM, and, obviously, Android.

Reasons of kotlin’s popularity over java

  1. Kotlin is more 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.
  2. Kotlin is more more concise than java,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.
  3. Kotlin is versatile and introperable 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.
  4. 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.
  5. 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.
  6. Restrictions in the Java language and the problems it presents and a language can’t be worked around. For example, we have this inability to add methods to types to classes or interfaces that we didn’t write ourselves. Traditionally, these wind up in util classes, just littered all over your code base or slammed together in one util package. While this is a solution, it’s certainly not ideal.
  7. The type system in Java, and especially in using it on Android, has problems with null, since it has no first-class representation of types that may be null or may not be null. Therefore, oftentimes the so-called “billion dollar mistake” of the null pointer exception ends up killing your app.
  8. Java is certainly not the most terse language. That’s not necessarily a bad thing by itself, but there’re many common idioms that just end up being overly verbose. This can potentially lead to errors and bugs in your code. On top of these, we have to deal with issues in the Android API.
  9. Android is a big inheritance party; they love their inheritance, which works well for them, but it tends to push problems on us as application developers. Kotlin also avoids extra garbage collection.a common problem in Android development that adds inefficiency to Java code.
  10. Furthermore, the nullability problem comes back, and this is especially apparent in Android, where they want things to be efficient. null is used in a lot of places to represent the absence of a value, instead of something that would wrap it in a more high-level type, like an either type or optional.

Conclusion

There’s these very specific things which allow you to take the problems of Android and potentially remedy them. The Kotlin website is absolutely fantastic with a ton of resources. There’s an interactive editor, where you can actually create and run Kotlin code in your browser. I encourage you all to go out and experiment with Kotlin.

--

--