Spent two weeks learning Kotlin while rewriting some messy Java code. Kotlin is awesome!


I just spent almost two weeks doing a major overhaul on my idea-multimarkdown plugin. The code mutated from original plugin which did not do any link resolution, inspections, lexing or PSI builder integration to where I bolted PSI lexing and parsing with link resolution on top, with a few oops moments as I learned Open API and plugin development on this part of the code. Needless to say, it was in desperate need of attention.

I started the rewrite in Java but quickly developed tourette’s. I have to maintain Java 1.6 compatibilty to support older IDEs and at that level Java is way past its best-before date. I was typing redundant code to satisfy the compiler not solve the problem. Even with IDEA doing the heavy lifting it was too much. I just bit the bullet and decided to do it in Kotlin.

My concern about missing the two week release schedule with major guts of the implementation on the table and a new language to learn, were unfounded. After a week and a half of coding and test writing, I was ready to rework the plugin to use the new model. Diving back into Java code was not pleasant. While making changes to Java code, I kept thinking that I can do this is 1/5 the code in Kotlin.

The experience has been a pleasure. Even with Kotlin 1.0 beta plugin quirks, I still prefer Kotlin to Java. The code is consise, terse and clear. I am slowly going through the mind-shift to lambdas and functional programming but I am already addicted.

Kotlin strikes an excellent balance between terseness, flexibility, type safety and ease of learning. I love that it is completely interoperable with Java, giving me the flexibility to migrate the code in stages. I still find myself trying to type in the tertiary operator and wondering why I get all the red lines and no completion suport but giving it up for the elvis operator and if/when as expressions is an good trade.

I should have made the switch earlier.

Awesome work guys!


Im agree with that, i learn Kotlin with Antonio Leiva. He is an awesome DEV and has a lot of tricks with Kotlin. His system is perfect for learn kotlin hyper fast.

Take a look on his posts here https://antonioleiva.com/kotlin/