In 2011, JetBrains — the company behind IntelliJ IDEA and many of the most widely used developer tools in the world — announced a new programming language called Kotlin. It was designed by people who used Java every day, were deeply familiar with its pain points, and had studied the solutions adopted by other modern languages.
In 2017, Google officially adopted Kotlin as a first-class language for Android development. In 2019, Google made it Kotlin-first, meaning new Android APIs and documentation target Kotlin as the primary language.
Understanding why Kotlin was designed the way it was helps you write better Kotlin code.
The Four Design Principles of Kotlin
JetBrains designed Kotlin around four explicit goals. Every language feature exists in service of at least one of these principles.
+----------------------------+
| Kotlin |
| |
| Readable Pragmatic |
| Safe Interoperable |
+----------------------------+
1. Readability
Readability is a first-class concern in Kotlin. Code is read far more often than it is written — by you three months later, by your team, by reviewers. Kotlin's design minimizes the friction between intent and expression.
Kotlin achieves readability through several features:
Type Inference
You do not need to write the type of a variable if the compiler can deduce it from context:
val name = "Alice" // Compiler infers: String
val count = 42 // Compiler infers: Int
val ratio = 3.14 // Compiler infers: Double
val active = true // Compiler infers: Boolean
This reduces visual noise without losing type safety. The types are still there — the compiler just does not require you to repeat what is already obvious.
Data Classes
A common pattern in Java is a class that does nothing but hold data — it has fields, a constructor, getters, setters, equals(), hashCode(), and toString(). In Java, this can be 50+ lines of boilerplate. In Kotlin:
data class User(val name: String, val age: Int, val email: String)
This single line generates a complete, immutable data-holding class with all standard methods. The intent — "this is a data container" — is immediately clear.
Infix Functions
Kotlin allows you to define functions that can be called with infix notation (without dots and parentheses), making certain operations read like natural language:
infix fun Int.times(str: String) = str.repeat(this)
val result = 3 times "ha" // reads naturally as "3 times ha"
// result == "hahaha"
2. Pragmatism
Pragmatism in Kotlin means the language is designed for real-world, large-scale software development — not academic purity. JetBrains uses Kotlin to build their own tools (IntelliJ IDEA, Android Studio, Kotlin plugin), so they have direct, high-stakes experience with the language's impact on productivity.
Pragmatism shows up in several ways:
It Solves Actual Problems
Kotlin was not designed to introduce exotic concepts — it was designed to fix the specific, concrete frustrations that Java developers encountered daily:
- Too much boilerplate
- Null pointer exceptions
- Verbose generics and type handling
- Lack of functional programming constructs
Every Kotlin feature has a practical motivation.
It Learns From Others
Kotlin studied and incorporated the best ideas from other languages — Scala's expressiveness, C#'s null-safety design, Groovy's DSL capabilities, Haskell's type system design — while keeping the result approachable and JVM-compatible.
It Prioritizes Industry Feedback
Because JetBrains builds industrial tools, Kotlin's development is driven by real engineering pain points rather than theoretical language design. Features that are too complex or rarely useful tend not to make it in, while features that save time every day get prioritized.
3. Safety
Safety in Kotlin means the language is designed to prevent common bugs at compile time rather than letting them surface as runtime crashes.
Null Safety
The most significant safety feature in Kotlin is its null safety type system. In Java, any reference can potentially be null, and null pointer exceptions (NPEs) are among the most common runtime crashes in production systems.
Kotlin's type system distinguishes between:
- Non-nullable types — the compiler guarantees these can never hold null
- Nullable types — explicitly marked with
?, the compiler forces you to handle the null case
val name: String = "Alice" // Non-nullable — guaranteed not null
val nickname: String? = null // Nullable — may be null
// Compiler error — must handle null before calling methods
val upper = nickname.toUpperCase() // ERROR
// Safe call — returns null instead of crashing
val upper = nickname?.toUpperCase() // Returns null safely
This pushes null-related bugs from unpredictable runtime crashes to predictable compile-time errors, which are caught before the code ever ships.
Designing for Inheritance Safely
Kotlin classes are final by default — they cannot be subclassed unless explicitly marked open. This nudges you towards composition over inheritance and prevents accidental breakage of class hierarchies.
open class Animal(val name: String) // Can be subclassed
class Dog(name: String) : Animal(name) // Subclass of Animal
class Cat(name: String) : Animal(name) // Also fine
// class Unknown : Dog(...) // ERROR if Dog is not open
This design principle, emphasized by Joshua Bloch in _Effective Java_, says: "Design and document for inheritance or else prohibit it." Kotlin makes the safe default the easy default.
4. Interoperability
Interoperability with Java is one of Kotlin's most important practical features. Kotlin runs on the JVM and compiles to the same bytecode that Java produces. This means:
- You can call Java libraries from Kotlin with no adapter layer
- You can call Kotlin code from Java with no adapter layer
- You can mix Kotlin and Java files in the same project
- You can incrementally migrate an existing Java project to Kotlin, file by file
+------------------+ +------------------+
| Kotlin Code | | Java Code |
+------------------+ +------------------+
| |
v v
+-----------------------------------------------+
| Kotlin / Java Compiler |
+-----------------------------------------------+
|
v
+-----------------------------------------------+
| JVM Bytecode |
| (Indistinguishable from Java bytecode) |
+-----------------------------------------------+
This is not just a convenience — it was a strategic necessity for Kotlin's adoption. The Java ecosystem is enormous. Decades of mature libraries, frameworks, and tools exist. If Kotlin could not interoperate with Java, it would have had to rebuild all of that from scratch, which is not feasible.
Interoperability means you can use Spring, Retrofit, Gson, Dagger, Room, Kotlin Coroutines, and literally any Java library ever written, from Kotlin code.
JavaScript and Native Interoperability
Kotlin's interoperability extends beyond Java:
- Kotlin/JS — Kotlin code can compile to JavaScript, enabling shared code between Android and web frontends
- Kotlin/Native — Kotlin can compile to native binaries for iOS, macOS, Linux, and Windows
- Kotlin Multiplatform — share business logic across Android, iOS, and web, writing platform-specific UI where needed
Kotlin in Context
| Feature | Java | Kotlin |
|---|---|---|
| Null safety | Runtime (NPE) | Compile time |
| Data classes | 50+ lines | 1 line |
| Type inference | Limited | Comprehensive |
| Extension functions | Not supported | Supported |
| Coroutines | External library | First-class |
| Lambdas | Java 8+ | From the start |
| Default parameters | Not supported | Supported |
| Smart casts | Not supported | Supported |
Why Kotlin Matters for Android
For Android developers specifically, Kotlin delivers:
- Less code — fewer lines of code means fewer bugs and faster development
- Fewer crashes — null safety eliminates one of the biggest sources of production crashes on Android
- Better coroutines support — Kotlin's coroutines are the recommended way to handle async operations in modern Android
- Official Google support — all new Android APIs, Jetpack libraries, and documentation are Kotlin-first
The Android community has largely completed its migration to Kotlin. Understanding Kotlin is not optional for serious Android development — it is the language of the platform.
Summary
Kotlin is built on four pillars:
- Readable — type inference, data classes, and infix functions reduce noise without losing clarity
- Pragmatic — designed for real-world engineering by engineers who face those problems daily
- Safe — null safety type system prevents entire categories of runtime crashes at compile time
- Interoperable — runs on the JVM, fully compatible with Java libraries, incrementally adoptable
Kotlin is not just a better syntax for writing Java. It is a thoughtfully designed language that changes how you think about software — pushing you toward safer defaults, clearer expression, and more maintainable code.
Learning Kotlin is learning how to write Android apps the right way.