Let’s talk about Kotlin?

Igor Leal
3 min readDec 15, 2017

--

Java has been around for a while, but let’s face it: it’s not really focused on productivity and is running a little behind on functional programmimg. Yes, Java 8 came up with many features but it is still behind many other languages. But I'm not writing this to point out the disadvantages of Java, it’s a great language that is still around and is not going to die soon. Because I have been working with Kotlin for the past months and getting into the language I decided to start a series of posts.

My idea with this series is to share with you why I’m considering Kotlin on new projects that I’d simply just code in Java.

If you have already seen some lines of code, I’ll clarify the situation with a quote from meddlepal at Reddit:

"Kotlin isn’t revolutionary but that’s what is nice about it. If you want revolution then there is Scala and all its headaches. If you want a language that basically codifies Effective Java then that’s Kotlin."

That’s important to know, because I won’t be presenting lots of revolutionary things. Most of the features I’ll talk about are already available in other languages. They will in fact be great tips for someone who already likes Java and wants to write a more concise code in fewer lines and still achieve the same functionality of the software.

So, to introduce Kotlin in case you’ve never heard of it. It was developed by JetBrains (the company behind IntelliJ, PyCharm, WebStorm and many other well-known tools) and made it first appearance in 2011. Its source code is open and available on GitHub. You can even track it’s issues publicly. And it gets better. There’s a really active forum where you can ask questions and suggests changes. At this forum the Kotlin team will answer you.

There are three main reasons for people to be considering Kotlin as a great language nowadays:

  1. It runs on JVM, which means you have all the benefits of it, like being cross-platform, a large set of libraries and many other things.
  2. It has lots of built-in functions for functional programming. If you want to use some functional programming but you don’t want or you can’t go to a strict functional language like Scala or Clojure, these built-in functions will be handy for you. Java 8 started with a few functions, but I’ll show how Kotlin is ahead on this point.
  3. You need to write less code to achieve the same goals you accomplish with Java. When you start getting familiar with Kotlin you’ll see like some keywords or characters you must type in Java are a real pain in the **s. They are a total waste of time. I’ll get into more details on this later.

Ok, you are now familiar with the language history and basic concepts, these are the posts:

  1. Java and Kotlin's interoperability
  2. Kotlin’s Null Safety feature
  3. Kotlin functions
  4. Functional programming features
  5. Iterators (coming soon…)

--

--