I try hard to adhere to the “Pragmatic Programmer” advice of learning a new language every year – a lofty goal! – and right now I’m trying to learn Kotlin.
Compared to Java, Kotlin is lovely. I read somewhere that it’s tried to “bake in” the recommendations from “Effective Java” (but it’s been so long since I read that book I can’t remember much). So far I’m only working through the website documentation and some tutorials. I’m liking most of Kotlin (
val, type inference, extension methods – adding new functionality to existing classes, a fair bit of support for FP style code) but when I started to get into the interfaces/classes stuff it really seemed to bog down: there’s a lot of syntax and machinery there and I didn’t get a sense, from the official documentation, about any “best practices” so it felt a bit like they’d built a lot of extra stuff on top of Java classes without necessarily improving on Java (i.e., it just has more features rather than being better/more concise overall). Well, there are “data classes” which are better/more concise than Java.
I think part of that is just how comfortable I’ve gotten with raw data and pure functions after using Clojure for 7+ years now. I’m sure I’d find any OOP language frustrating in that area these days: so much incidental complexity!
I can’t imagine any production scenario where I’d use Kotlin in preference to Clojure. Perhaps if I was doing a lot more Java interop, I might use Kotlin to wrap nastier Java APIs? Or perhaps if I needed to write a native Android app? (no chance of that)