Table of Contents
Cross-platform shared logic
While not as revolutionary as some other programming languages, Kotlin
has been steadily growing in popularity over the past couple of years.
The initial spike on May 17, 2017, was caused by the Google Android team officially announcing
first-class support for Kotlin.
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.
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
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!
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)
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.
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/
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.