Learning Kotlin
Categories: Java, Programming
I’ve finally got around to learning Kotlin, a popular language best known for running on the JVM and competing with Java.
Not only is Kotlin a “better Java”, it is also the recommended language for writing programs for the Android platform. It can also be compiled to Javascript, ie can compete with things like Typescript as a “type-safe language for browser-hosted code”. Interestingly, it is also working on “native” support for compiling to various machine-codes (eg x86, ARM). Most interestingly of all, it is working on compiling to WebAssembly for high-performance cross-platform applications.
My personal notes on Kotlin are available, but they are probably not of interest to anyone but me.
What might be interesting is that I recently converted a demo Spring/JPA program from Java to Kotlin.
- Java SLOC: 1368
- Kotlin SLOC: 1075
Change: (1075 - 1368)/1368 = 21% fewer lines of code
That’s not world-changing, but definitely worth having.
In general, I found the Kotlin version of this app easier to read, and less likely to have bugs. Programming was also more fun. I’ll be using Kotlin where possible in the future.