What is Kotlin

Virat Kumar
3 min readJul 29, 2024

--

What is Kotlin , where do we use kotlin and how it interoperates with jvm

Kotlin is open source, multiplatform, multi-paradigm, statically typed, and general purpose programming language. Let’s look at each one by one:-

  1. Open Source:- Kotlin is an open-source language. The source code of Kotlin compiler is available on GitHub and anyone can use it for redistribution and modification. Initially, it was maintained by JetBrains. But, now Kotlin Foundation is maintaining it. There is also a public process known as KEEP (Kotlin Evolution and Enhancement Process) through which anyone can propose and comment on official language design changes.
  2. Multiplatform:- Kotlin can be used on many platforms like Android, IOS, Windows, MacOS, and Linux. You write your code once and you can run it on Android and iOS.
  3. Multi-Paradigm:- Kotlin supports many programming paradigms. It supports object-oriented programming and functional programming.
  4. Statically Typed:- Kotlin is a statically typed language. The types of the objects and functions declared are known at the compile time.
  5. General Purpose Programming Language:- Kotlin can be used in many places it is being used in Android development, backend development, and frontend development. Any general-purpose program can be developed using Kotlin.

Kotlin Platforms

Kotlin is a compiled program language. It means you write your code once in Kotlin and then use the Kotlin compiler to produce the machine code that can run. Kotlin source code can be compiled into Kotlin/JVM, Kotlin/Js, Kotlin/Native, and Kotlin/Wasm(alpha).

Kotlin/JVM is the technology that compiles the Kotlin source code into JVM bytecode that is equivalent to Java source code compiled into JVM bytecode. This means Kotlin and Java are fully interoperable. All the libraries written in Java can be used in Kotlin. Similarly, Kotlin source code also can be used from Java code although it has some limitations (Kotlin coroutines).

Java and Kotlin can be used together in a single project. One example of that is the Kotlin compiler itself. Initially, it was written in Java and all the new files were written in Kotlin.

Kotlin/Js is the technology that compiles Kotlin source code into Js source code. This allows us developers to use Kotlin in front-end development.

Kotlin/Native is the technology that compiles Kotlin source code into platform-dependent machine code. This technology allows us to write code once and run it on any platform.

Kotlin/Wasm compiles Kotlin source into web assembly that allows us to develop frameworks and libraries that can directly run in browsers.

Kotlin IDE

Android Studio and Intellij Idea are the two most famous IDEs for writing Kotlin. But you can use VS Code, Eclipse, Vim, or any text editor. But the formers have better support for the language.

Where do we use Kotlin?

Backend Development:- It can be used anywhere where Java is used. Writing code in Java is quite time-consuming and syntax is complex. That’s why Kotlin is used there. For example, Nowadays many developers use Kotlin with Spring framework for backend development. Many developers use Kotlin frameworks like Ktor for backend development.

Android Development:- In 2019, Google announced it would support the Kotlin-first approach. It means that now Google has developed all its libraries and toolkits in Kotlin primarily for Kotlin.

Frontend Development: Kotlin can also use the React framework for front-end development.

Jetpack Compose:- It is a new UI toolkit developed by Google for Android developers. It is used to write declarative UI in Kotlin. It uses Kotlin compiler plugins.

As you can see, there are a lot of domains where Kotlin can be used. After learning Kotlin, I am sure you will find many good ways to apply your knowledge.

Hello World! in Kotlin

fun main() {
println("Hello World!")
}

Interested in personal training for Kotlin, KMP, or Android development? Contact me at virat@codeancy.com to learn more!

--

--

Virat Kumar

Android Developer , KMP. I talk about kotlin, native android development and kotlin multiplatform development.