Learning Android: Java or Kotlin?


Most people use an android phone and know the convenience of it. What many are not aware of is the work that happens behind the curtain. There are various languages through which Android is designed and the hot topic of debate which has taken the tech world by storm and left everyone scratching their heads, Learning Android: Java versus Kotlin.

Before we debate on it, why learn Android App Development?

Android is everywhere, from smartphones to TVs to automobiles and is the most popular OS with over 2 Bn active users every month. While your Android phone creates a smooth user experience for you, the apps installed in it make the whole journey easier – right from booking a cab and tagging your friend on embarrassing memes to ordering dinner (or finally finding your dream date)! You can find over 3.3 Mn+ Android apps on Google Play Store – which has easily surpassed the IOS Store.

What Is the Entire ‘Java vs Kotlin’ Debate All About?

Historically, developers have been using Java for Android App Development because of its core features which are object-oriented, simple, portable, and secure using virtual machines. Android is based heavily on Java and the Android SDK includes many standard Java libraries.

It runs on nearly all platforms and has a rich Application Programming Interfaces (APIs) which is why it is still the most preferred language for mobile app development. But Java has its own set of limitations, like:

a. Java is old and error-prone without significant improvement in older versions like Java SE 8 and Java SE 7, used by most developers.

b. Developers who use Java for Android say that it doesn’t even have support for lambdas, method references, streams, or try-with-resources.

c. Another problem with Java is the way it handles ‘null’ which leads to the controversial Billion Dollar Mistake (NullPointerException) – now you know why few apps crash a lot!

d. You need to code a lot in Java to perform simple actions.

What Could be a Solution to All These Problems? Kotlin – of Course!

Back in 2011, when the brains behind JetBrains in Russia started noticing the limitations of Java, they decided to come up with a language with the best features of Java (and other basic programming languages) and addresses the limitations. Sounds incredible?

Kotlin, an open-source language is statistically-typed and runs in a Java Virtual Machine (JVM). It became popular because:

a. You code less (for eg. you have the lambda function in the Kotlin) and develop smaller-sized apps – Kotlin is crisper and more readable than Java (YAY!)

b. It can also interoperate with Java’s code – which means, you can open your existing project in Kotlin with all your Java code intact!

c. Kotlin has avoided having extra features like its own build system as open source tools can already handle it nor does it re-implement the entire Java framework.

d. The apps running on Kotlin crash less because the problem of NullPointerExceptions was taken care of right while developing it.

e. JetBrains took care to ensure that Android Studio 3.0 can support Kotlin 100%.

Then the BIG announcement happened – Google announced Kotlin as the official Android development language at Google I/O 2017 in September.

If you have no prior experience in Android App Development, then Kotlin is for you. But if you are a Java-veteran, then Kotlin is something new – it’s not a challenge but it would make your work way easier.

It doesn’t mean that Java is going to be obsolete but in tech, any new language gets easily adapted, especially if it solves the limitations of other programming languages.

With myriads of opportunities for Android Developers, now is your chance to delve into the magical world of Android and let the magic happen.

(Disclaimer: This is a guest post submitted on Techstory by Sarvesh Agarwal, founder, and CEO of Internshala – an internship and training platform. All the contents and images in the article have been provided to Techstory by the author of the article. Techstory is not responsible or liable for any content in this article.)

Image Credit: Salonurody.info