π Presentation of Kotlin
Kotlin is a modern programming language developed by JetBrains.
Some features
- Kotlin compiles to many targets: the JVM, JS, WASM, Android, iOS, Desktop, native code, etc.
- Many server frameworks officially support Kotlin such as Spring and Quarkus.
- It is the first-class language for writing Android.
- Kotlin can compile to native with Kotlin native or with GraalVM.
- KMP allows to share code between different platforms.
- Kotlin can be considered as both fullstack and corss-platform language.
- Inter-operable with Java.
- Provides modern features such as compile-time null safety and data classes.
- Supports Object oriented programming and functional programming.
- Kotlin KEEP is its open source evolution process.
History
- February 15, 2016: Kotlin 1.0 was released.
- January 04, 2017: Spring introduced Kotlin support in Spring 5.
- At Google I/O 2017, Google announced first-class support for Kotlin on Android.
- On 7 May 2019, Google announced that Kotlin the preferred language for Android app developers.
- June 2022: Kotlin 1.7 was released with the version of the new K2 compiler.
Some numbers and facts
- As of 2022, Kotlin is used by 7.8% of the industry experts.
- According to StackOverflow, Kotlin was the 4th most beloved language in 2020 with 62.9% votes.
- Kotlin is now listed among the top 20 programming languages by Redmonk.
- Kotlin is among the top 3 languages that most businesses are planning to migrate their apps to in 2022.
- Kotlin is used by global companies like Google, NetFlix, Amazon, Trello, and more.
- Pinterest and Uber are among the companies that migrated their apps to Kotlin from Java.
Please find more statics here:
Why switch from Java to Kotlin
Here are some arguments that motivate switching from Java (version 17 LTS at the time of writing) to Kotlin.
- Kotlin supports more targets than Java.
- Kotlin has compile time null-safety (Java Optionals are runtime wrappers for nullable values and null annotations have less features).
- Kotlin strings support interpolation.
- Casting in Kotlin is smart.
- Kotlin functional programming features are better. It even allows to define Type-Safe builders and DSLs.
- Kotlin can be mixed with Java code, thus helping the migration process.
You can read more arguments in these articles:
- Java Vs Kotlin: Which One Is Better To Learn In 2022?
- 8 Reasons Why You Should Switch To Kotlin From Java
A decision tree to help you decide if you should use Kotlin
Prerequisites
- Recommended: IntelliJ IDEA (Both community or ultimate are OK),
- or GitPod by opening https://gitpod.io/#https://github.com/worldline/learning-kotlin to create a workspace and then browser to the material folder,
- or VSCode (with Kotlin and Java plugins) + JDK 17 (install via scoop.sh on windows or SDK man on Unix) + gradle