While you are hibernating in your room, under the cozy blankets, reading this article on your smartphone, and while I pretend to write this article at work while actually following the commentary of India vs South Africa cricket series, the tech world has been taken by storm. Programmers, newbies as well as advanced, are scratching their heads over what to use for developing Android apps – Java or Kotlin!
Before we debate on it, why should one learn Android App Development?
From smartphones to TVs and automobiles, Android is everywhere and is the most popular operating system with over 2 Bn active users per month. While your Android phone provides you a satisfying user experience, the apps installed in it make the whole journey smoother – right from booking a cab and tagging your friend in embarrassing memes to ordering in 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 App Store.
So, what is the entire ‘Java vs Kotlin’ debate all about?
For years developers have been using Java for Android app development because of its core features which are object-orientedness, simplicity, portability, and security. 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 any significant improvement in older versions like Java SE 8 and Java SE 7, which are used by most developers.
b. Developers who use Java for Android say that it doesn’t 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, i.e. NullPointerException. The NullPointerException occurs when you use a variable which doesn’t exist or has a null value. Now you know why few apps crash a lot!
d. You need to code a lot in Java to perform simple actions.
So, what could be the 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) minus its 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 instance, you have the lambda function in Kotlin) and develop smaller-sized apps. Kotlin is crisper and more readable than Java.
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. It also doesn’t 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 Kotlin was being developed.
e. JetBrains made sure that Android Studio 3.0 can support Kotlin 100%.
And 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 the tech world, any new language gets easily adapted especially if it solves the limitations of other programming languages.
Excited to learn Android app development using Kotlin?
Great, we have an amazing offer for you! Register for Internshala’s Android training and learn to create your own app with an additional discount of 10%. Who knows your friends might start downloading your Android app on their phones pretty soon!