Search results for

All search results
Best daily deals

Affiliate links on Android Authority may earn us a commission. Learn more.

10 reasons to try Kotlin for Android development

Kotlin development is now supported by Android Studio by default, but why should you care? Here are 10 good reasons to give Kotlin a try!

Published onJune 26, 2017

At the latest Google I/O conference, Google announced that Android Studio would soon support development with Kotlin out of the box. While this was big news, it may have left some people a little cold if they aren’t familiar with Kotlin. Kotlin is a popular programming language that will serve as an alternative to Java going forward. But why should that interest you? What are the benefits of development with Kotlin?

Let’s count down the top 10 benefits of development with Kotlin.

1. It’s super easy to set up

Developers have actually been able to use Kotlin for some time via a plugin but as of Android Studio 3.0, it’s going to be as simple as ticking a box to ‘Include Kotlin support’.

2. It’s interoperable with Java

Try saying that five times quickly! Kotlin is interoperable with Java, meaning that you can use Java frameworks and even mix commands from both languages in your code!

3. It reduces boiler plate code

‘Boiler plate’ in the context of programming refers to the lines of code that you keep having to include which don’t actually add to the function of your code. Kotlin uses a number of handy tricks and methods to reduce this ‘extra’ code and in doing so, helps users to create apps more quickly and simply. We’ll examine some specific examples in this list.

Kotlin regularly uses significantly less code to get the same thing done

4. The Synthetic extension

There are lots of useful extensions available for Kotlin, many of which can make life considerably easier for Android development. One particularly useful example is ‘Synthetic’, an extension that allows you to completely do away with typing findViewByID. Add one line of code and you’ll be able to access views directly with no need to use their IDs.

If that’s gone over your head, then it is suffice to say this can  reduce your code by hundreds of lines over the course of a large project. This is my personal favorite advantage of Kotlin!

5. You can choose your own programming philosophy

Unlike the solely object-oriented Java, Kotlin uses both object-oriented and functional constructs. This means that you aren’t forced to use object oriented programming if you find it confusing or if you come from a functional background. Freedom to choose can only be a good thing!

Read Next: Kotlin Coroutines help you with asynchronous programming

6. No more null pointer exceptions

Also known as ‘the billion dollar mistake’, null references are the bane of Java developers and are responsible for more crashes on Android than pretty much any other error. Kotlin seeks to make this a thing of the past in all but a few cases with “null safety”. Just one more way that it streamlines development!

7. No semi-colons

This might sound like a small thing at first, but the fact that Kotlin code doesn’t require you to end lines with semi-colons means that you will never have to hunt for missing punctuation again! You’re still able to use them if you so wish, but you’re once again free to choose…

8. No overhead

Writing an app in Kotlin versus Java will not incur any overhead: your app will be no slower and no larger than it would be otherwise. Kotlin’s standard library is small and light and it runs on the Java Virtual Machine, just like Java.

9. There’s already good support

Built-in Kotlin support might be new for Android Studio, but developers have been using it for a while now on Android and elsewhere. That means there’s plenty of support and community to help you get started and there are already a number of apps in the Play Store that were built using Kotlin.

10. Learning new languages is always a good thing

This is an excellent opportunity to pick up a new programming language and expand your knowledge. Kotlin is used for web development and server-side development too, so you’ll be adding more strings to your bow.

Closing Thoughts

There are many more benefits to Kotlin that I haven’t mentioned here that will appeal to some developers. For example, exceptions are unchecked, and lambda expressions are supported. In general, Kotlin is readable, relatively simple to pick-up for beginners and in many ways more modern than Java. If you want to find out more then check out my introduction to Kotlin for Android development tutorial.

A lambda expression, saving us yet more time