I started to learn Kotlin after Google’s announced it as one of the official languages for the Android platform and in the heath of the moment I wrote my first impressions in this article. I thought that’s it and never considered as a viable alternative for my production applications but I was wrong. Now after half a year I feel the need to write more words about it.
Currently all my Android projects, yes all my Android projects are migrated to Kotlin and I am more productive and happier than ever. After I started programming in Kotlin I was hooked, I simply couldn’t go back to Java anymore, at least not for Android development. I write code on a daily basis for more than 16 years and in all these years, I only fell in love with a few languages: C, Object Pascal, C# and now Kotlin. The main reasons I love Kotlin are: functions, null safety, expressiveness, beautiful and elegant syntax, really nice support for immutable structures, data classes, when statement … who am I kidding, I love everything about it 🙂 . It’s type safe, it’s concise has great tooling, it’s perfect. The idea is that upfront it looks just like any other language, but there are lots of small constructs that makes it really pleasant to use. I think last time I felt so much joy writing code was when I wrote an interpreter in C a few years ago. Just look at this piece of shit in Java:
private Connection connection = new Connection(); private List<Student> listOfStudents = new List<Student>();
I mean Connection connection = new Connection(). WTF!!. I know we want to be explicit but this is painfully explicit! In Kotlin something like this would be written as:
val connection = Connection() val listOfStudents = listOf()
As I said, it doesn’t look like much, but give it a try, it’s great. I will stop here with this “Ode to Kotlin” but in future posts I will write about some nice patterns you can use 🙂 .
If you found this post useful, please feel free to share and give it a LIKE ❤ , so others can find it too! Also if you want more content like this please hit the FOLLOW button. Thanks 😊