Kotlin
A modern, concise programming language that runs on the JVM, Android, and compiles to JavaScript or native code.
Created by JetBrains
Kotlin is a modern, pragmatic programming language developed by JetBrains. Designed to be fully interoperable with Java while being more concise and safer, Kotlin has become the preferred language for Android development and is increasingly popular for server-side applications.
History & Origins
Kotlin was born from JetBrains’ real-world experience. As the creators of IntelliJ IDEA and other developer tools, JetBrains engineers worked extensively with Java and understood its pain points intimately.
In 2010, JetBrains began developing a new language to address Java’s verbosity while maintaining full compatibility with the existing JVM ecosystem. The language was named after Kotlin Island near St. Petersburg, Russia, where many JetBrains developers are based—a nod to Java being named after the Indonesian island.
The Problem Kotlin Solves
Java, despite its maturity and ecosystem, has notable frustrations:
- Verbosity: Getters, setters, equals(), hashCode(), toString() boilerplate
- Null pointer exceptions: The “billion dollar mistake” in software
- Limited type inference: Explicit types everywhere
- No modern features: Lambdas came late, pattern matching still limited
Kotlin addresses these directly:
- Concise syntax: Data classes, property syntax, smart casts
- Null safety: Nullable types are explicit, checked at compile time
- Type inference:
val name = "Kotlin"instead ofString name = "Kotlin" - Modern features: Lambdas, extension functions, coroutines, sealed classes
Rise to Prominence
Kotlin’s trajectory changed dramatically in 2017 when Google announced official support for Kotlin on Android at Google I/O. By 2019, Google declared Kotlin the preferred language for Android development.
This endorsement was transformative:
- New Android documentation is Kotlin-first
- Official samples and codelabs use Kotlin
- Jetpack libraries are designed with Kotlin in mind
- Jetpack Compose (modern Android UI) is Kotlin-only
Why Kotlin Succeeded
- 100% Java interoperability: Call Java from Kotlin and vice versa, use existing libraries
- Gradual adoption: Convert file by file, not all at once
- Google’s endorsement: Official Android support legitimized the language
- JetBrains backing: Created by tooling experts, excellent IDE support
- Pragmatic design: Focused on solving real problems, not academic purity
- Null safety: Eliminates entire categories of bugs at compile time
Kotlin Multiplatform
Beyond the JVM, Kotlin now targets multiple platforms:
- Kotlin/JVM: Server-side, Android, desktop applications
- Kotlin/JS: Compile to JavaScript for web development
- Kotlin/Native: Compile to native binaries (iOS, embedded, WebAssembly)
- Kotlin Multiplatform: Share code across platforms while keeping native UIs
Kotlin Multiplatform Mobile (KMM) allows sharing business logic between Android and iOS apps while writing platform-specific UI code.
Modern Kotlin
Kotlin 2.0 (2024) brought the new K2 compiler:
- Faster compilation: Up to 2x speed improvement
- Better IDE support: Faster code analysis and completion
- Foundation for future features: Enables language evolution
Key language features:
- Coroutines: Lightweight concurrency without callback hell
- Sealed classes/interfaces: Exhaustive when expressions
- Inline classes: Zero-overhead type wrappers
- Extension functions: Add methods to existing classes
- DSL capabilities: Build type-safe domain-specific languages
Kotlin vs. Java
| Feature | Kotlin | Java |
|---|---|---|
| Null safety | Built-in, compile-time | Optional types (added in Java 8+) |
| Data classes | One line | Dozens of lines (or records in Java 16+) |
| Type inference | Extensive | Limited (var in Java 10+) |
| Extension functions | Yes | No |
| Coroutines | Native support | Project Loom (preview) |
| Default arguments | Yes | No (overloads needed) |
| Smart casts | Yes | Limited (Java 16+ patterns) |
Java has been catching up with records, pattern matching, and virtual threads, but Kotlin remains more concise and expressive for most use cases.
The Kotlin Community
Kotlin has a welcoming, pragmatic community focused on solving real problems. JetBrains actively engages through:
- KotlinConf: Annual conference
- Kotlin Slack: Active community discussion
- KEEP: Kotlin Evolution and Enhancement Process
The language continues to evolve based on community feedback while maintaining backward compatibility.
Timeline
Notable Uses & Legacy
Android Development
Google's preferred language for Android. Most new Android apps and all official samples are written in Kotlin.
JetBrains IDEs
IntelliJ IDEA, Android Studio, and other JetBrains tools are increasingly written in Kotlin.
Spring Framework
Spring Boot has first-class Kotlin support, with dedicated DSLs and extensions.
Gradle Build Tool
Gradle's modern build scripts use Kotlin DSL (build.gradle.kts) as the recommended approach.
One of the first major apps to adopt Kotlin, converting their Android codebase.
Netflix
Uses Kotlin for Android development and some server-side applications.
Language Influence
Influenced By
Influenced
Running Today
Run examples using the official Docker image:
docker pull zenika/kotlin:1.4Example usage:
docker run --rm -v $(pwd):/app -w /app zenika/kotlin:1.4 sh -c 'kotlinc Hello.kt -include-runtime -d hello.jar && java -jar hello.jar'