1 Kotlin: What and why

 

This chapter covers

  • A basic demonstration of Kotlin
  • The main traits of the Kotlin language
  • Possibilities for server-side and Android development
  • A glimpse into Kotlin Multiplatform
  • What distinguishes Kotlin from other languages
  • Writing and running code in Kotlin

Kotlin is a modern programming language on the Java virtual machine (JVM) and beyond. It’s a general-purpose, concise, safe, and pragmatic language. Independent programmers, small software shops, and large enterprises all have embraced Kotlin: millions of developers are now using it to write mobile apps, build server-side applications, and create desktop software, among several other applications.

Kotlin started as a “better Java”—a language with improved developer ergonomics that prevents common categories of errors and embraces modern language design paradigms, all while maintaining the ability to be used everywhere Java was used. Over the last decade, Kotlin has managed to prove itself to be a pragmatic fit for many types of developers, projects, and platforms. Android is now Kotlin first, meaning most of the Android development is done in Kotlin. For server-side development, Kotlin makes a strong alternative to Java, with native and well-documented Kotlin support in prevalent frameworks, like Spring, and pure Kotlin frameworks exploiting the full potential of the language, like Ktor.

1.1 A taste of Kotlin

1.2 Kotlin’s primary traits

1.2.1 Kotlin use cases: Android, server side, anywhere Java runs, and beyond

1.2.2 Static typing makes Kotlin performant, reliable, and maintainable

1.2.3 Combining functional and object-oriented programming makes Kotlin safe and flexible

1.2.4 Concurrent and asynchronous code becomes natural and structured with coroutines

1.2.5 Kotlin can be used for any purpose: It’s free, open source, and open to contributions

1.3 Areas in which Kotlin is often used

1.3.1 Powering backends: Server-side development with Kotlin

1.3.2 Mobile Development: Android is Kotlin first

1.3.3 Multiplatform: Sharing business logic and minimizing duplicate work on iOS, JVM, JS, and beyond

sitemap