Avid developer who has a passion for | 

Learn more about myself and what makes me so passionate about various forms of software development.

Thoughts on Kotlin

Posted On 2021-09-07

This summer was very busy, my wife, and I sold our house and then bought a new one and if that all wasn't enough to keep me busy, I was learning kotlin.

If you didn't read my previous blog post, I was looking to learn kotlin just to learn a new skill and also because I was interested in KMM. I have been playing around with kotlin off and on this summer and so far it's not too bad, a few things takes time to get used to, but it overall is fun to develop in.

While I'm interested in KMM, I have decided to start off with a native Android app in kotlin as my small dip in KMM, it seems things are still too rough and unpolished, and I decided I'll circle back once that platform is more developed and when I have a better grasp on kotlin.

what things have been the biggest struggles programming in kotlin for me?

First thing was the way you typecast, now it's mostly because every other language I've worked with has done it like so:

C#:

private string someVar = "hello";

Java:

private String someVar = "hello";

PHP:

private string $someVar = "hello";

and kotlin does it like so:

private var someVar: String = "hello";

again, not a major deal but when you've done it one way for your whole career it's a bit of a mental reflex I've had to keep in check when writing in kotlin.

my second struggle was coroutines, which is really nice, but again it's a mental flex issue as I've mostly done async development in C# and it's just something that took a few attempts to get the hang of it, but overall I do like the direction they went with.

Honestly my struggles as a whole are more I'm used to how to do something in another language I'm more comfortable with, let's switch the vibe a bit and talk about what I love about kotlin.

I am in love with data classes, I love the concept of them, and they are a great addition that I'd love to see C# or PHP copy.

I also like how you add a constructor to an object.

class Person(firstName: String) { /*...*/ }

This feels a lot cleaner to me.

I'm still figuring things out, but as a whole I do like the language, and I'm looking forward to learning more about it and improve my skills in kotlin.

I'm sure I'll be writing some kotlin articles in the future as I work through things and find something worth writing about.