loading...
Cover image for Why we need Kotlin?

Why we need Kotlin?

jay_tillu profile image Jay Tillu😎 ・3 min read

Computer language innovation and development occurs due to two fundamental reasons:

  1. To adopt environmental changes.
  2. To adopt improvements in the art of programming.

Behind the creation of Kotlin second factor plays a vital role. Java is a third generation language and is widely used since 1991. Java is a really powerful and versatile language used on a really wide scale. You can say Java is everywhere on server-side Java is there, on mobile app development Java is there, on embedded devices java is there, on console-based development Java is there.

But as time goes Java fails to adopt the modern features of programming. And that modern features becomes the core reason behind the creation of Kotlin.

Let’s take a look at some major issues in Java:

Lack of modern features for android development


The latest version of Java (Java 11) is come up with a lot of amazing features. But as we all know for android development we still use Java 6 and Java 7. Which lacks a lot of modern features like Lambdas, Method references, streams, try-with-resources,, etc.

There are some third-party ways to back-port some of these features like Retro-lambda, Streams backport, and ThreeTenABP, etc. But it’s a pain to use them via third-party tools.

Google releases some pain via supporting some Java 8 features from Android Nougat, but most of them usable only when you target minSdk Version 24. But you should not do that at this time due to Android fragmentation.

See Android distribution chart.

Lack of Safety against NullPointerException


“I call it my billion-dollar mistake. It was the invention of the null reference in 1965…This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.” — Sir Charles Antony Richard Hoare (Creator of Null)

More than 70% of app crashes during its lifetime due to null pointer exception. Null pointer exception comes in top 5 reasons for android app crashes. Now you can easily imagine the impact of null pointer exception on your app. And Java does not provide any way of protection against null pointer exception. The developer has to handle it on his own. This makes java unsafe for app development.

lot of Boilerplate code


Developers always love clean and concise code. Less code takes less time to write, less time to read, and also makes easy to maintain it.

If you know Java, you probably aware of how much boilerplate code needs to get the simplest job done. Even for the smallest task, you need to create classes and objects and all that stuff. But in Kotlin you will write a fairly small amount of code compare to java to get your job done

So guys above are three major drawbacks of java. And that’s why we need Kotlin.

Please check every day for new posts on Kotlin and other programming topics. Till then Keep Coding, Keep Loving.

Wanna get in touch with me? Here are the links. I’ll love to become your friend. 😊
Twitter
Facebook
Instagram
Medium
or just mail me at jayviveki13@gmail.com

Posted on by:

jay_tillu profile

Jay Tillu😎

@jay_tillu

🌏 विधायास्य धमॅस्य संरक्षणम् 🌍 ☀️ Society before Self ☀️ 🙏🏻 Humanism by Religion 🙏🏻 💻 Work for Mankind 💻 🌐 Believes in वसुधैव कुटुम्बकम् 🌐

Discussion

pic
Editor guide