Skip to main content

Kotlin Learning Notes - First Impression



This is my first week of using Kotlin. Coming with a background of Golang for the last 7 years, I was surprised by the richness and smartness of such a "modern" language. This blog is to share some of my early thoughts on the language. Of course, I will share more of my learning experience, gotchas and thoughts going forward.

So here are my early thoughts:

  • Richness. Golang's design principle is to make language support minimal. One example is that there is no standard library for Set in Golang and it's common to use maps as an alternative. As a result, Golang code is usually verbose since a programer has to implement lots of low-level functionality. On the contrary, Kotlin has access to a large set of syntax sugars, lambdas, standard libraries as well as Java libraries. This makes Kotlin feel higher level compared to Golang, hence easier to write, but harder to standardize code style.
  • Null safety. I love this feature! It saves tons of code boilerplate for checking null and largely improves program safety.
  • Smartness. Kotlin builds lots of smartness into its compiler, e.g. smart cast, smart null check. Certainly, it brings lots of safety to the program. But I imagine it will take longer for a programmer to write idiomatic code due to the steeper learning curve.
  • Generics. Anyone who has written Golang for some time would hate the lack of generics support in Go. As a modern language, Kotlin obviously has this feature under its belt. 

Comments