Turning attention to Kotlin

Why I’m turning my side project attention to a new JVM language

Divan Visagie
From The Couch
Published in
4 min readAug 3, 2017

--

If you have read my medium blog before you might have come across the fact that my side hobby for a while has been writing applications in Scala. And the reason mostly comes down to the fact that I enjoy the syntax and find it nice to work with, however , earlier this year something happened.

Google announced that it would support Kotlin in Android. I immediately recognized this as a sign that Kotlin was here to stay, and not only that, thanks to its more business than academic approach, many more developers would be prepared to pick it up than Scala due to its smaller size and the fact that most Kotlin code looks like it was written by mortal humans and not Haskell super gods.

In typical reaction fashion I thought “hey let’s give this thing a shot” and started working through the documentation. Then at some point I started missing the Uniform Access Principle sugar I so love from Scala , one of its key selling points that in my view makes it such an elegant language.

At this point the minimalist in me started waving a red flag and asking the question. Does this language give you any benefit? Are you going to practically use it? And if not , will it teach you something new?

The answer at that time was a no. I saw nothing in Kotlin so far that I hadn’t already seen in another language, and I needed to focus my time on more practical things.

A few months had now passed and I was trying to do something new. A side project that I could carry to the end, a side project that could open up avenues beyond just casual self amusement, and would probably attract more developers to hop on board.

Naturally , I wrote the proof of concept in Scala. It was beautiful, it was elegant and it was… difficult to explain. Not only to the family members I was visiting at the time but to pretty much anyone who hadn’t seen Scala before.

So I had to make a decision, I had to choose something easier to understand that more people could pick up. By far the most ubiquitous , easy to pick up way to build back end applications is using express and Node.JS, but I have been treated so well in the JVM landscape. I was able to trust the packages for third party libraries that I pulled from the maven repositories when I was working with Scala, a luxury that I yearn for every time I have to deal with npm pulling something new that breaks things.

Another issue is that even though I am quite a front end heavy developer in my day job, when it comes to back end stuff, I like having static typing, the dynamic stuff is nice for DOM manipulation and quick prototypes, but I have gone to the point of switching out an entire back end to .Net before in a side project because Node became unmanageable.

I’m not going to get too deep into “Why not node”, There are plenty of reasons for not going with it , there are also plenty for using it. Right now though , I choose to avoid it if at all possible. So for this project , Node was out.

Next on my list of possibilities was actually .Net core, but that didn’t last very long. Kestrel looks to be interesting, but It looks like one might have to build quite a lot yourself if you go that route and Nancy looks like its in a transition to 2.0 which is always the most horrible time to pick up a technology.

C# is also one of the most brutally inelegant languages of all time encouraging obscene practices such as { on a new line and capitalized method names. Yes , its my side project and I can choose to be a little irrational… and have taste.

I had convinced myself, I wanted the JVM , but Scala was not going to cut it , and neither was Java8. It has modern features, yes. But then I remembered how you have to convert stuff to streams to use maps and a whole bunch of other rubbish I have become used to not dealing with. I just wanted a better Java, and sure enough, I found my self back at Kotlin.

So this is it, I now finally have a reason to use Kotlin, and ignoring the lack of UAP sugar, I have found it quite nice so far. Only time will tell if the decision will pay off , but I will say that it is a relief to work with a language that is by comparison much smaller and to be fair, better documented with a community less obsessed with monads and writing the purest most functional program possible.

Don’t get me wrong , I still love Scala, but Kotlin sits neatly in the middle between elegance and practicality.

--

--

Divan Visagie
From The Couch

I write about tech and anything else I find interesting