12:07 | 12.07.19 | Articles | exclusive 121865

The story and philosophy of Kotlin, a cross-platform programming language

More and more activity is observed in the world of programming around Kotlin, a cross-platform, statically typed, general-purpose programming language with type inference.

Kotlin is designed to interoperate fully with Java, and the JVM version of its standard library depends on Java Class Library, while type inference allows its syntax to be more concise. Kotlin mainly targets JVM, but it also compiles to JavaScript or native code (via LLVM). Kotlin is sponsored by JetBrains and Google through Kotlin Foundation. Kotlin has been Google’s preferred language for Android app development since May 7 of 2019.

The name comes from Kotlin Island, near St. Petersburg. The team decided to name it after an island just like Java was named after the Indonesian island of Java.

In June 2019, Mediamax’s reporter visited JetBrains and attended the meeting with Andrey Breslav, one of the top minds of JetBrains, the creator of Kotlin programming language. The visit of the group of international journalists was organized by ITMO University. Andrey Breslav is also an ITMO University graduate and former teacher.

photo © Andrey Breslav's Twitter page


The birth of Kotlin

A person I knew invited me to JetBrains office once to discuss some ideas, and I thought it was going to be about the specific languages that they were using. However, it turned out that they actually considered the creation of a new language. The company was thinking about what else could be done for programmers and figured out that a new programming language would be the best choice for them.

I said at the meeting: “Why? There are already many languages available. Ok, you don’t like Java, but there are alternatives.” Eventually, they told me a few things I didn’t know. I have an academic background, so they explained to me that the existing languages were too academic and didn’t naturally work in many industrial settings. Another important argument was that JetBrains company already had a very good position in the market to actually start a new programming language and make it visible.

photo © ITMO

The philosophy behind Kotlin

Kotlin is a unified programming platform, where you can write applications that span multiple devices, which means Kotlin can run on a server, in a web browser, on the mobile phone of any system. It’s one common platform of languages for all devices; the same language, the same ideology and the same methodology, but they run differently, because the environments they are written in are different. People like Kotlin because of its flexibility. The philosophy was creating a modern language for the industry.

We wanted to integrate new good ideas that had been tested in the industry by the time․ We have always cared about having smart teams that want to use intelligence for solving problems. We have built things that make interactions with those languages easier․ The programming is expensive, because you write the program once, then you fix it forever. Everybody dreams of not having so many bugs. We’re trying to help find errors, inconsistencies as easily as possible. We care about readable code; we try to make it more readable through conciseness among other things.

Nowadays, we have code running on multiple devices, and these devices have to work synchronously. There is latency between them, so if I ask on my phone something from the server, the phone has to wait until the server answers, meanwhile my screen is frozen, so I’m very angry. And this is a big problem. It’s important to avoid blocking the user or the device, while you’re waiting for something. That’s called a synchronous competition, where we can ask something and keep working on something else while the answer is coming. We don’t block the user, but if we wait synchronously for things, we’re very slow. This is something we have in the language; we’re trying to make it easy.

photo © Andrey Breslav's Twitter page


Things Kotlin doesn’t do

We don’t do systems programming. If you want to write an operating system, Kotlin is not the right choice for you, because we have automatic memory management, which is not preferable for that case; if you do operating system, you want to manage memory yourself. Basically, all competition tasks are very approachable for any industrial grade programming language, so Kotlin is good there.

The future of Kotlin

When we look into the future, we definitely bet on the cross-platform aspect, because everybody is dreaming about it, but every solution has a lot of shortcomings. If you ask people who do mobile development if they want to write an application once and run on both Android and IOS, they would definitely answer positively. If you ask them what they think about the solution, they would say: “Oh, man, this is very difficult.” We are joining the club of people, who try to solve this issue, and so far the results are very interesting. We have very passionate fans, so hopefully this will grow bigger.

We are looking into data science, big data processing and business intelligence. It’s about reaching outside of our normal area of expertise, because this audience is not necessarily programmers; there are many people with research background. We’re trying to introduce more disciplined programming into this interesting area, and hopefully it will be a lot of help to these people. IoT and game development are also very interesting directions for us.

Currently, we have a set of features that is only stable, which means that we guarantee that they won’t change in an incompatible way. We have already reduced the set of features that are experimental, so we are actually working on them.

It would be great to have a completely clean programming model to change the way people think about programming. We need to remove global things from this picture entirely, which will make reasoning about code easier.

Marie Taryan