DEV Community

Discussion on: Simple, yet powerful features of Kotlin

Collapse
 
niharmore33 profile image
nihar

Let’s take a look at the things you need to know about ‘Kotlin: The Latest Powerful Language to Streamline Android App Development’.
Learn Kotlin here: hackr.io/tutorials/learn-kotlin

How is Kotlin different from Java?

Well, case studies have shown the main reason is that it represents a cleaner approach to app development, and will likely serve as a better entry for new Android developers. It also help developers in number of instances like:

Concise

Kotlin eliminates null references for example and it doesn’t have checked exceptions – both of which can save developers from head crunch. As you’ll see, various new features of Kotlin also allow us to get rid of boilerplate code too, resulting in leaner and more readable programs.

Kotlin_BrainMobiBlogs

Kotlin Extensions for Android

Tired of using findViewById and started using the famous Butterknife library. Then you will love Kotlin Android Extensions too. The Kotlin Android Extensions plugin allows us to obtain the same experience we have with some of the popular libraries but without having to add any extra code or shipping any additional runtime. Here is a simple example to showcase the incredible flexibility offered by Kotlin. Just create a Kotlin file and paste the following snippet in it:

Kotlin_BrainMobiBlog

Performance

A Kotlin application runs as fast as Java, thanks to very similar bytecode structure. With Kotlin’s support for inline functions, code often runs even faster than the same code written in Java.

Learning curve

For a Java developer, getting started with Kotlin is very easy. The automated Java to Kotlin converter included in the Kotlin plugin helps with the first steps. Kotlin Koans offer a guide through the key features of the language with a series of interactive exercises.

Safe

Avoid entire classes of errors such as null pointer exceptions. Get rid of those pesky NullPointerExceptions, you know, The Billion Dollar Mistake.

Safe_BrainMobiBlogs

Interoperable

Kotlin is 100% interoperable with Java, allowing to leverage existing libraries for JVM, Android and the browser in a Kotlin based application. This includes annotation processing, so data binding and Dagger work too. Means Kotlin can call Java, and Java can call Kotlin.

BrainMobi_Blog
BrainMobi_Blog

In our next blog, we will discuss in brief some of the advantages which Kotlin offers over Java.

Why are developers excited about Kotlin support?

Kotlin is a perfect fit for top Android developers to embrace while building exemplary Android apps. It’s a statically typed programming language for modern multiplatform applications and offers a whole new work experience. Other than the whole new experience, Kotlin also offers some great methods explained above to make great cuts on unnecessary burdens. The code written with Kotlin is simpler than the Java equivalent, even when it references the same libraries or classes. It makes debugging a breeze.