The essential guide to Android happiness begins with Kotlin

Image: iStockphoto/m-imagephotography
Apple developers may have been glad to see Swift quickly rise in the wake of Objective-C (though some still think it’s “crap”), but Kotlin, an open source, statically-typed alternative to Java for Android developers, has some dancing—Sound of Music style. “Since the beginning of Android, we developers have been stuck with a dated version of a dated language,” bemoaned Viacom developer Danny Preussler, but Kotlin, according to Basecamp developer Dan Kim, “makes me happy.”
Odds are it may do the same for you. Here’s why.
The Dark Ages of Java
Though Kotlin is still comparatively puny in terms of popularity, it has blazed into the top-50 languages on the Tiobe Index, and also leaped to #46 on the Redmonk ranking, prompting Redmonk’s Stephen O’Grady to write: “The big question facing Kotlin then isn’t whether it will experience gains based on interest – the language already has jumped nearly twenty spots in a year’s time which is very unusual – but how quickly, and to what degree.”
Why? After all, Kotlin has been around since 2010, generating only “low-key buzz,” as developer Steve Yegge termed it. That buzz, however, has steadily grown, and when Google threw its weight behind Kotlin, the buzz became a deafening roar.
SEE: Jaded by Java? Android now supports Kotlin programming language (ZDNet)
Suddenly, the Android community had a programming language that felt like Swift. (Though, again, not everyone thinks this is a good thing.) More importantly, it felt like something written for modern development. As Jessica Thornsby has pointed out, Java is hardly a modern language and, even as it slowly evolves, Android only supports a subset of those evolving features. Yegge was less diplomatic:
If the language you’re using happens to be Java, then you’ve no doubt realized that by the time Java becomes a really good language, you’ll be dead. Loooong dead. I know we don’t like to contemplate our own mortality, but when you plot the trajectory of Java from its birth 20+ years ago to its full knee and hip replacement with Java 8, you can’t help but wonder, “Am I going to be stuck with this for literally the rest of my life? What if this is as good as it gets?”
It’s an odd juxtaposition: Fast-moving mobile development with a glacially slow-moving programming language. The two don’t seem to mix, venerable as Java may be.
But there’s more to Kotlin’s popularity than a strong desire to abandon Java by the wayside.
Getting that spring back in your step
For Kim, “Kotlin makes me a happier (better) programmer.” The reasons, he wrote, are several:
Writing code that’s concise, clear, and expressive makes me happy. Focusing on creative solutions to business problems, not boilerplate and ceremony, makes me happy. Feeling an intense motivation to learn, which was missing in the Java days, makes me happy.
SEE: Android App Development: Easy & Quick Programming (TechRepublic Academy)
Getting to that dopamine rush of happiness, in turn, comes super quickly. Preussler calls this out, declaring: “The learning curve of Kotlin is really low.”
Yegge, impressed by how “gorgeous” Kotlin code is, took this theme and ran with it:
I took [Kotlin] for a test drive. And within maybe four or five weeks, just like that, I was rewriting my 20-year-old game server platform in Kotlin. One month of using Kotlin and I was sold….It only took maybe 3 days to learn Kotlin well enough to start busting out code, fully aware that I didn’t know what the hell I was doing, but knowing the language and IDE were doing a great job of keeping me out of trouble anyway.
Not only is Kotlin easy to learn, but, he wrote, “Everything you write in it feels like you made something cool.” Can a developer write cool code with Java? Sure. But it comes at a cost Yegge wrote:
Kotlin is just butter: Tailor-made for us Java programmers who are still sort of scratching our heads over Java 8’s parallel streaming filterable collecting scheduled completable callbacking futuring listening forking executor noun kingdom. Kotlin gives you all the same power — substantially more, actually, with its coroutines support — but makes it way easier to say stuff. Java 8 lets you say interesting things, but you have to do it with a mouthful of sand.
In short, life just got sunny for Android developers. As developer James McShane told me, Kotlin “makes me enjoy my daily work more.”
All of which is great news for Android. Already the market share leader, Android development may quickly emerge as a labor of love, not of duty. At Google’s announcement of Kotlin support, one developer gushed, “I’m almost crying right now.” Fortunately for Android, those are finally tears of happiness, not Java-laced despair.