~/VibeHandbook
$39

App / Mobile

kotlinlang.org

Kotlin

What it is

Kotlin is a modern, statically-typed language from JetBrains that runs on the Java Virtual Machine and fully interoperates with Java. Google made it the preferred language for Android development, and it's also used for server-side code, multiplatform shared logic, and even compiling to native or JavaScript. It aims to be concise, safe, and pragmatic — Java without the ceremony.

Strengths

  • Null safety built into the type system, eliminating most NullPointerException crashes.
  • Concise: data classes, extension functions, and smart casts cut boilerplate dramatically.
  • Seamless Java interop — use any Java library, migrate file by file.
  • First-class coroutines for readable asynchronous and concurrent code.
  • Kotlin Multiplatform can share business logic across Android, iOS, and backend.

Trade-offs

  • Compilation can be slower than Java in large projects.
  • The JVM means a runtime and some startup overhead compared to native languages.
  • Multiplatform and Kotlin/Native are maturing but less battle-tested than the JVM target.
  • Some advanced features (coroutines, DSLs) have a learning curve.

When to use it

Reach for Kotlin for any new Android app, and consider it for JVM backend services where you want safer, terser code than Java. It's a strong default wherever the JVM ecosystem fits.

Vibe coding fit

Kotlin works well with AI assistants because its concise idioms mean less code to generate and review, and null safety surfaces mistakes at compile time. Ask the model to favor immutable val over var, to use data classes for models, and to write suspending functions with coroutines rather than manual threading. When targeting Android, have it pair Kotlin with Jetpack Compose so UI and logic share one modern language.

data class User(val name: String, val active: Boolean = true)

fun activeNames(users: List<User>): List<String> =
    users.filter { it.active }.map { it.name }

fun main() {
    val users = listOf(User("Ada"), User("Lin", active = false))
    println(activeNames(users))
}