Kotlin — Why we use it!

Kotlin is now an official language for Android. At this year’s edition of its annual I/O conference, Google said it was “excited” to work with JetBrains, which created the language, on the port.”

This statement comes from I/O conference in 2017. Kotlin has continued to be the first-class language for Android — promoted by google and is now used by many other products even outside the sphere of android app development.

Some prominent names are Uber, Coursera, Corda, Spring and Gradle.

In this article we introduce you to Kotlin and some of the reasons why you should consider it for your next project.

Not just for Android, but ANY Java project.

What is Kotlin

Kotlin is a statically-typed, modern programming language Developed by JetBrains & Open-source contributors. It runs on a Java Virtual Machine (JVM) by compiling Kotlin code into Java bytecode. It can also be compiled to JavaScript source code and to native executables. Kotlin is flexible and has some cool features!

Why adopting Kotlin is easy

Learning Curve

It’s easy to learn, especially for people used to modern languages, even more so for someone knowing Java. The Java to Kotlin converter in IntelliJ and Android Studio makes it even easier. You can also use a mix of Kotlin and Java in a project, so take your time learning Kotlin and add it in when you feel comfortable. Kotlin Koans offer a guide through the key features of the language with a series of interactive exercises.


It’s compatible with JDK 6, so older programs can be supported.


It’s on par with Java.


It’s 100% interoperable with Java including annotations.


The runtime library for Kotlin is tiny.

Compilation Time

There’s a little overhead on clean builds but it’s way faster with incremental builds.

Features that devs will appreciate

Null Safety

Kotlin’s type system is aimed at eliminating the danger of null references from code, also known as the The Billion Dollar Mistake. One of the most common pitfalls in many programming languages is that accessing a member of a null reference will result in a null reference exception. In Java this would be the equivalent of a NullPointerException or NPE for short.

In Kotlin, the type system distinguishes between references that can hold null (nullable references) and those that cannot (non-null references).

For example, a regular variable of type String cannot hold null. To allow nulls, we can declare a variable as nullable string, written String?

var b: String? = “abc”

Less Boilerplate

We often create “model” classes (whose main purpose is to hold data) in Java which have properties, and then add boilerplate code such as getters, setters, toString, equals, hashcode. You must use libraries like Project Lombok to get around this if possible, in Java.

In Kotlin, you avoid this whole shebang by simply prefixing the “data” keyword to your class definition. The compiler then automatically derives toString, copy, componentN members for all properties declared in the primary constructor. And properties in Kotlin also generates getters/setters for you behind the scenes.

Click HERE to see how Kotlin reduces a 58-line Java program to ONE line.

Extension functions

Extension functions let you add methods to classes without modifying their source code. (Without having to use decorator patterns or any of that noise)

This looks at first like a superficial bit of syntax sugar to avoid utility style classes. Then you realize that doing it this way enables you to easily discover the new methods via auto-completion, lets you build powerful language extensions and lets you integrate existing Java APIs with other Kotlin features.

For example, you can write new functions for a class from a third-party library that you can’t modify. Such functions are available for calling in the usual way as if they were methods of the original class. There are also extension properties that let you define new properties for existing classes.

Better generics

If you never fully got to grips with what exactly super and extends mean when put inside a type variable, don’t worry: it’s not you. Java’s generics really are just confusing. Kotlin fixes it.

Functional programming

is supported with lambdas and ability to do mapping, folding etc. over standard Java collections. The Kotlin type system distinguishes between mutable and immutable views over collections.


Uses markdown instead of HTML. Yay.

No semicolons

Enough said;


The == operator does what you actually expect.

There’s lot more but this should be more than enough to convince you to at least try it out! You’ll be on the Team Kotlin before you know it!


Kotlin also transpiles to JavaScript, so you can write any frontend/backend JS code in a type safe fashion in Kotlin. See HERE.

Play with Kotlin NOW!

Go on. And let us know what you think!




Building the future, one BLOCK at a time. Blockchain R&D engineer @PersistentSys.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Roadmap To Becoming a DevOps Engineer

Post-migration Checklist for Enterprises And SMBs

PWA? What They Are & Why They Matter

5 Docker most useful commands

A Computer Takes the LSAT: Question 6

CRD for CRDs to design platform services from Helm charts

Configuring Flask for production

Create a Pandemic Simulation with Unity II: Analyzing SIR graphs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amol Pednekar

Amol Pednekar

Building the future, one BLOCK at a time. Blockchain R&D engineer @PersistentSys.

More from Medium

Learn Kotlin -Null Safety

Dependency Injection | Much Easier now… :)

Android Protobuf with kotlin and Wire

Kotlin Null Safety and Operators.