DEV Community

Vadim Lopatka
Vadim Lopatka

Posted on

Switching to Kotlin. Short overview.

Here I am not going to talk about any Kotlin-specific features or my favorite ones, but instead, it will be a high-level overview of the switching process, the first results, and how it influences my team.

About a year ago we decided to move our project(about 50 microservices that were written in Java (preferably), Scala, Groovy, NodeJs) to Kotlin.

  1. Maintainability
    What at first seemed like just "syntactic sugar" has improved the readability, expressiveness, and, as a result, maintainability of the code.
    It is clear that this is not only about the language, but it is great when a language promotes such aspects.

  2. Immutability
    The language strongly motivates to write immutable code and offers a wide range of functionality for this.
    As a result: we have moved away from storing the state in services and now we have several instances of each service. Consequently, we can scale horizontally under an increasing load and we could not use it before.

  3. Interoperability
    Kotlin has great interoperability with Java. You can call Kotlin written functions from Java and vice versa.
    In fact, you do not have to rewrite the whole service in one shot, which creates a gups in delivering value. It is painful for the business and often just impossible.
    We carried out our transition gradually, step by step.
    Rewriting component by component, without breaking or destroying anything, and at every moment of time, our code remained functional, delivered new features to clients, and continued to make money.

  4. Satisfaction
    The pleasure, the ease of working with the codebase has increased, and I believe this is important. When the team is happy, everyone wins.
    Now it is clear that the initial investment of time and effort was justified.

-1. Weakness
An obvious drawback was and remains the speed of compilation, type inference, and hints in the IDE.
It's really annoying, and especially when switching from Java, where everything is good with these things.

But we have good news here!
It seems that the guys from JetBrains perfectly understand what they are doing! ;)
Alt Text

Top comments (0)