Categories
Groovy Java Kotlin Software Development Spring

Kotlin

Last year (2019), I finally had the chance to work with this newcomer to the JVM languages. For reasons I will explain in just a few more lines, we (the dev team) decided to port a Spring Boot application which I had written in Groovy to Kotlin.

Given that I had to be thanked or blamed for the existence of this application and I was only making my first steps in JetBrain’s language, my main responsibility in this undertaking was not so much to contribute code but rather to review it.

The developer doing most of the coding had already worked with Kotlin and since “it was just porting” that gave us a chance to compare both languages side by side in a real world project.

It was a good way for me to learn Kotlin. It was an excellent way to collaborate and share knowledge as a team.

Did the resulting code work better?, did it outperform its predecessor?, was the code way more elegant or readable? NO.

We weren’t expecting any of that either. At least I wasn’t. Wait. What? So, what was the reason behind this rewrite?

I would say that the reason for rewriting was that it seemed like the ideal project and moment to make a small investment as developers and as a company.

Tip 8: Invest Regularly in Your Knowledge Portfolio.

As I did in my previous post, I draw upon the wisdom of The Pragmatic Programmer

The ideal project because it was not very complex or critical. It was a good project to experiment upon.

The ideal moment because the boost Kotlin received when it was backed by Google for Android development (2017) and when it became a first class language in Spring (from 5.0 onwards) made it seem back then and now like a massively adopted language.

In a small detour from my main point, today I noticed that the Tiobe Index seems to disagree a bit. Despite that, I would still bet my money on Kotlin raising to the top 20 in short time.

Some languages that were supposed to break through in 2019 didn’t: Rust won only 3 positions (from #33 to #30), Kotlin lost 3 positions (from #31 to #35)
January 2020: #23 Groovy, #32 Scala, #35 Kotlin

On the other side, Groovy’s adoption seemed back then and now to be decreasing. Also, the community was receiving some bad news at that time, like: Cédric Champeau stepping down from the Apache Groovy Project.

When talking about similar programming languages, “popularity” is important because it creates a community, it attracts companies, and thanks to that you get awesome things like: open source libraries, frameworks, IDEs, better support, more questions and answers on Stack Overflow, etc. etc.

I’m not trying say that one language is better than the other just because its more popular or because of its increased adoption. That’s not my point. But it does matter and should be taken into account when investing in yours and your team’s knowledge portfolio.

I intend to compare these JVM languages ( Java, Groovy, Kotlin & Scala; perhaps also Clojure) from a more technical perspective in future posts. I’ll try to explain the pros and cons I’ve found in my experience using and learning or re-learning them.

Ok, this post is now longer than I expected. I’m going to say three things to wrap it up:

  1. If you have to take anything from here is that Kotlin is a very good investment for any [Java] developer because it’s a modern, well designed, cross platform language with great tooling (dah!, it’s from JetBrains).
  2. A very good intro to Kotlin is Kotlin for Java Developers. It’s offered by JetBrains and one of the instructors is Andrey Breslav, the Lead Language Designer of Kotlin. The programming assignments are not difficult but if for some reason you get stuck it might help to take a look at this repo.
  3. Have fun coding!

1 reply on “Kotlin”

Leave a Reply

Your email address will not be published. Required fields are marked *