Why we chose Kotlin as one of the company’s target languages. Part 1: Retrospective

DomKlik company has existed since 2015, and during this time we managed to change the target language for developing key services from Java to Kotlin.

My name is Alexander Kotsyuruba, I lead the development of internal services at DomKlik. Answering the question why we switched to Kotlin, I will publish two materials:

  1. The first part will be devoted to a retrospective of the emergence of the language (which you, in fact, will now read)
  2. The second part will be focused on practical examples (which will be released later)

So, let’s begin.

image

2010 year:

  • in August, a parade of planets
  • In early December, Zurich hosted the announcement of Russia as the host country of the 2018 FIFA World Cup
  • JetBrains releases Intellij IDEA 10.0 at the end of December

For JetBrains, the IDE is the main product, and they, as an IT company, are interested in the rapid development and quality of their products. Intellij IDEA is being developed on the JVM 6 platform. On the one hand, the virtual machine copes with the load perfectly, is reliable, like a Kalashnikov assault rifle, and is represented by an impressive community. Java, on the other hand, is starting to slow down. This is due, inter alia, to financial difficulties at Sun Microsystems – they begin to pay less attention to the language, it can be seen from the release frequency of Java.

Timeline for Java and Intellij IDEA releases:


As you can see, JetBrains managed to release six major versions of Intellij IDEA. While Java has advanced only one. Moreover, Java 6 was not a big breakthrough, as, for example, Java 5.

At the time of 2010, Java had already come of age (~ 20 years old, the start of development in 1990) and slightly “overgrown with moss” in the amount of> 50k classes. According to Andrei Breslav abreslav, who is participating as an external expert in developing lambdas for Java, adding such functionality without disrupting the JVM was quite difficult (one of the reasons to postpone the release of functionality in Java 8).

This encouraged JB to look in other languages ​​for developing its products. The company had competencies for development in languages ​​that were popular at that time Groovy and Scala.

From Groovy had to be abandoned due to the shortcomings of dynamically typed languages:

  1. Slow language performance in runtime
  2. High cost of refactoring
  3. Lack of a full-fledged IDE

Scala also not suitable for internal development of JetBrains:

  1. Lack of a full language IDE
  2. High entry threshold
  3. High cost of developers
  4. Compiler performance

It is worth noting that Scala was a successful project in terms of combining different concepts in one language.

At the same time, JetBrains, when developing a particular development environment, writes a front-end compiler for the corresponding language. This includes parsing the semantic tree, highlighting, etc. In other words, describes half the work of the compiler. Having at that time 7 IDEs, we can say that JetBrains developed 3.5 compilers.

Obviously, concise code will help focus on business logic, which in turn will increase development speed and reduce the risk of error. Java 6 did not contribute to this, and the life of the language and platform itself was incomprehensible (referring to the SUN and rumors of sales in Oracle Corp). This prompted the company to develop a language for its internal needs.

Key language requirements were as follows:

  1. Compatible with Java (as the company already had a lot of code in Java)
  2. Conciseness
  3. Quick
  4. Type safety

So the project called Kotlin was born.

2010 – 2016:

2012:

By this time, MVP Kotlin appears.

JB puts Kotlin in open source status and begins to actively use it for internal development of the IDE. Based on the results of internal use experience, it is planned to decide whether to release the first release of the product.

2016:

Kotlin 1.0 is released with support for JVM 6 and Android. At this time, DomKlik also pilots Kotlin and releases a secure settlement service written on it – a non-cash way of settling a property between a buyer and a seller. The developers are satisfied with the laconicism, capabilities and ideas of the language and decided to include Kotlin in the list of “allowed development languages.”

2017 – our days:

March 2017:

Kotlin 1.1 is released. Among the significant features it is worth noting:

  1. JVM 8 support
  2. Coroutines (experimental version)
  3. JavaScript compiler

A couple of words I want to add about compilation in JS. Given the experience in developing front-end compilers and development needs, Kotlin almost from the very beginning set itself the task of supporting multi-platform (Kotlin MPP, more in the article later).

2017 November:

Kotlin 1.2 is released. The release includes:

  1. Multi platform support
  2. Compiler in native code (experimental version)

Support for multiplatform means the ability to connect modules to a project that are specific to a particular platform, or common to platforms.

At the same time Google includes default Kotlin language support in Android Studio 3.0. In my opinion, this is a significant event for the Kotlin community, as in fact, the language has been recognized by the Android community in the face of the giant Google.

2018:

In October, release 1.3 is released, including stable backward compatible coroutines and a compiler in native code.

In the same year, a decision was made by the architectural committee in DomKlik to change the target development language from Java to Kotlin.

2019:

In 2019, an important event takes place for the Kotlin community – all the same, Google at the conference sets Kotlin as the standard for developing Android applications.


In the spring of 2019, we reach a tipping point in changing Java to Kotlin. Our graphs show that Kotlin has outperformed Java functionality. In other words, we began to write more in Kotlin than in Java, and our core competence de facto changed to Kotlin.

Our days:

Today it is worth noting the existence of Kotlin for Data science. I would like to highlight this topic separately, diving deeper and showing advantages in the following articles.
In our company, on the server-side, Kotlin dominates in comparison with Java by more than 3 times.

In general, we have a variety of programming languages ​​in our company:

Kotlin compilers:

With Kotlin MPP, you can use Kotlin as the default language in development in your company. We at DomKlik conducted a successful pilot to develop a mortgage calculator on Kotlin MPP for the Kotlin / JVM (Server-Side + Android) + Kotlin / Native (iOS) platforms. Our future plans are to expand the pilot to Kotlin / JS.

And summing up.

The first part of the article came out theoretical and historical, which is why it is a retrospective. The second part will be closer to practice, in it we will consider the example of Kotlin / JVM:

  1. how he lives with the Java compiler
  2. Let’s take a look at a few cases from Kotlin and how they work out on the Java platform.

Useful resources:

  1. kotlinlang.org
  2. Report by Andrei Breslav – What is Kotlin? Introduction
  3. Report by Andrei Breslav – Project Kotlin

Similar Posts

Leave a Reply

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