The Economics of Software in eMobility: Financial Strategies & Optimal ROI

Webinar 09.05

close button
DevelopmentBackendKotlin

What is Kotlin used for?

12 NOVEMBER 2020 • 5 MIN READ

Krzysztof Ciombor

Krzysztof

Ciombor

What is Kotlin used for header

Introduction

While not as revolutionary as some other programming languages, Kotlin has been steadily growing in popularity over the past couple of years.

kotlin google trends chart

The initial spike on May 17, 2017, was caused by the Google Android team officially announcing first-class support for Kotlin.

Android development

Of course, this shouldn’t be at all surprising that the majority of Kotlin development is done for Android mobile apps. Official docs encourage Kotlin usage and most SDK docs offer snippets of code in Kotlin making it very easy to get started. Growing popularity on StackOverflow means that it’s sometimes easier to find the answer to your question in Kotlin than in Java.

Many big companies already switched their development to Kotlin and are amazed by the results. Big names on this list include Google and JetBrains themselves, Amazon, Netflix, Coursera and, Uber, but many smaller companies are also making the switch.

See more:

Cross-platform shared logic

Android development is not the only thing we can do in Kotlin though. By leveraging Kotlin Multiplatform Mobile capabilities we can create a re-usable domain logic code that can be shared between mobile apps on Android and iOS. Even though this project is still in the alpha phase, some big companies are already experimenting with this technology and the results are promising. The premise of sharing business logic between multiple platforms is very appealing both in terms of development speed as well as maintenance costs. This was clearly visible in the recent shift towards cross-platform frameworks like React Native or Flutter, but it should soon be possible to do the same with Kotlin.

See more:

Web development

Web development is basically all JavaScript, but that does not mean other languages cannot be used for this purpose. Languages like Typescript, Elm, Clojurescript, or ReasonML are all used in Web development by transpiling them back to JavaScript. Using Kotlin/JS we can do the same with Kotlin! If you don’t want to abandon your current knowledge about React, Redux, React Router, or even styled-components, take a look at the kotlin-wrappers repository which provides wrappers for all those libraries and more.

Kotlin/JS gives you all the benefits of Kotlin while still allowing you to interact with DOM or use npm packages directly inside Kotlin code.

Remember Kotlin Multiplatform? It works for Kotlin/JS as well, which means the business logic can be shared between Android, iOS AND web version of your app!

See more:

Backend development

By this point, you may be thinking that Kotlin is perfect for front-end parts. Turns out it is pretty nice on the backend side as well. If you’re already familiar with the usual Java backend stack which uses Spring Boot it is very easy to make the switch to Kotlin and it’s now easier than ever to write Kotlin-idiomatic code in Spring Boot.

If you’re searching for a lightweight server-side framework in Kotlin, ktor is gaining more and more traction within the community.

Going all-in on Kotlin? By using multiplatform capabilities, one can easily create a full-stack application and share business logic between all frontends and backend (for things like validation logic, shared models, etc)

See more:

Kotlin native

Sometimes we cannot, or don’t want to, use a virtual machine (JVM), for example when targeting embedded devices. That’s where Kotlin/Native comes into play.

Not only can it produce native Windows, Linux or MacOS binaries but it can even support iOS, watchOS, tvOS, and WebAssembly. It is easy to include compiled Kotlin code directly in an existing C/C++ project as well as call native code directly from Kotlin/Native.

See more:

Data science

Although Python is still very much dominating the data science scene, Kotlin is making its appearance here as well. If you want to leverage JVM capabilities and performance while writing concise, statically typed and null-safe code, Kotlin may be a perfect fit for you. Afraid of losing your favorite tooling? Don’t be! Kotlin kernel for Jupyter Notebook and Kotlin interpreter for Apache Zeppelin will let you do the exploratory research and data visualization within those interactive editors. Want to jump straight into deep learning? Being fully interoperation with Java libraries, Kotlin can integrate seamlessly with existing open-source projects like https://deeplearning4j.org/

See more:

Final thoughts

As we can see, Kotlin can be used for a wide variety of subjects, starting with Android development and ending among native binaries. Be aware, as some of those technologies like Kotlin Multiplatform and Kotlin/Native are still quite new and can be rough around the edges, but this wide spectrum of Kotlin capabilities shows that there is a real interest in such a versatile programming language. Both the team behind Kotlin and the community are working very hard to make this vision a reality.

Since it is very easy to integrate Kotlin with Java, if you already have a Java project (maybe an Android app or a backend service), don’t be afraid to give Kotlin a try. Who knows, maybe this time it will save you from the billion-dollar mistake?

Not convinced? Feel free to reach out, and we will help you make the switch to Kotlin.