The Awakening
When Kotlin was announced as a first class Android language at Google I/O in 2017, I like many Android developers, was skeptical. As an ardent user of Jetbrains products for a number of years now I haven't been oblivious to Kotlin, but I've only recently begun to take Kotlin seriously. In fact, after developing CoinWatch in Kotlin, I don't know that I'm going to start another Android project in Java (willingly) ever again.
Don't get me wrong, Kotlin isn't perfect. But if you stick with this series, I'm pretty sure I can make you a convert. Kotlin is steadily being used by more and more developers, and is gaining more support and features in Android. Many tutorials are not only be written in Kotlin, but in some cases, solely in Kotlin. More major libraries are offering Kotlin versions, plugins, and support.
Where did I start?
The first time I used Kotlin was on a side project. I found an open source Gradle plugin that did 75% of what I needed, and short of home rolling my own solution, I had to modify the plugin.
When I started going through the plugin the syntax seemed clunky, overly verbose, and unreadable. I was almost turned away from the language completely, but as I worked more on the plugin, I realized that it was mostly just the code style of the developer plugin that was the problem. As I read through the Kotlin documentation and a number of tutorials on Kotlin and Android plugins (this was my first time creating/modifying a plugin too), I gained a appreciation of the language and the considerations that went into it.
After I finished with the modifications to the plugin I still continued to develop in Java and it wasn't until a while later that I decided to make my own Kotlin Android app. Already being familiar with the language made it a little easier to adjust, but it wasn't until I actually made that app that I realized the potential of Kotlin over Java for Android.
Where am I going to from here now? (or “cool story guy, get to the point")
Over my next few blogs I'm going to point out the good and bad about Kotlin. I want to call this an introduction to Kotlin rather than a tutorial, because while I'm going to be factual, I'm also going to present my opinions. You're still going to learn about Kotlin and how to use it, but I like to avoid the whole “my way or the highway” mentality fostered by step by step tutorials. We all have our preferences and opinions. Kotlin isn't perfect, but it is well worth your time to learn and understand. Before using Kotlin the first time, I greeted with the same amount of skepticism if not more than most people. I thought there was an unreasonable amount of fanaticism around the language generated in a short period of time. I basically thought of it as a fad, but a short while later now, I'm pretty convinced that Kotlin is here to stay.
So, to keep things on track. Here's what I plan to go over in the next few weeks:
- Nullability
- Type system
- Classes
- Control flow
- Exception handling
- Unit Testing with Kotlin
- Android implementation
I really hate to feel like I'm advertising it too much, but if you'd like a look ahead take a look at CoinWatch. I wouldn't suggest using the app day-to-day, there are better ones out there, but I will be drawing from my lessons learned with building CoinWatch to write this blog