Indie pig.
Indie Pig Indie games and experiences.

Monday 24th, November 2014

What is Kotlin?

Skip to Tutorials

This article is at the time of Kotlin 0.9.266, and some parts are likely to be quickly out of date.

Kotlin is a general purpose programming language developed by JetBrains1. It runs in the Java Virtual Machine, or it can transpile2 to JavaScript.

I was recently introduced to Kotlin because LWJGL - The Lightweight Java Game Library is writing its next iteration from the ground up in Kotlin. I'd never heard of Kotlin before so I thought I'd check it out.

What I see shows a lot of promise. For a full description go to their site - http://kotlinlang.org/, but I will share some of my personal opinions and what excites me the most.

Kotlin's biggest advantages in my opinion:

Kotlin runs in the JVM, which is cool, but not unique; several languages (Groovy, Scala, ColdFusion) do this as well, but where Kotlin impresses me, is that Kotlin can sit alongside Java code seamlessly. I can have a Java class and a Kotlin class sitting side by side and most code is a seamless cross-over.

The joke about programming languages is that there are as many languages as there are computer science PHDs. Every hip new language attempts to solve a problem, but if it solves one problem while creating two more, you will find yourself falling back to the old reliable (C++, Java, PHP, JavaScript).

I believe that Kotlin is making choices to poise it for longevity. It is solving some real problems with Java (and many superficial ones) while maintaining complete interoperability. This means you won't find yourself painted in a corner in terms of usable libraries, runtime performance, or deployment issues.

There are, however, some thorns in this garden of roses. The first, as with any new language, is, "How many developers actually know it?" Not many. Adoption is a difficult rock to roll. Java is the second most used language in the world, and currently Kotlin doesn't even make the list. (Scala is somewhere around #20 according to poplang.org) Another thorn is that Kotlin is currently in beta. While I've had few friction points so far with Kotlin in the JVM, Kotlin to JS has much polish needed.

My dream is to do what I can to help front-end web development move in a direction more friendly for scalable, internet-application development. While there may be environments and workflows currently closer to this dream (Dart, TypeScript, CoffeeScript), I believe that Kotlin has a stronger foundation that may help it succeed where others have fallen short. My secondary dream is to have a workflow that, if not directly portable, is at least familiar across many different platforms and systems. I would love to have the same workflow and possibly even shared code for Web as I do Mobile as I do Desktop.

I know I've said some contentious things, keep in mind that these are only opinions, and I'll quickly explain how I feel about some of the leading javascript languages.

Ok, enough! How do I get started?

To help people get started learning Kotlin here are tutorials for a hello world in KotlinJVM and a hello world in KotlinJS

If you aren't sure which one to try first, the JVM setup is much easier.

1 I am not affiliated with JetBrains in any way.
2 Transpile is a made up term that means to change code from one language to another (without compiling to byte code).

 

Add your comment