Skip to content

Learning Kotlin

December 2, 2018

I’m building a UX prototype at work that’s relatively well-contained and not facing an immediate deadline, so I’ve been using it as an opportunity to learn Kotlin (in combination with Big Nerd Ranch’s Kotlin Programming Guide; I used their original iOS programming guide way back when to learn Objective-C, so I have a good opinion of their books).

So far my impression is fairly positive. As is often pointed out, it’s less verbose than Java (although with the introduction of lambda functions in Java 8, the language did get a bit slimmer). And functions are first-class entities, so you can use a more functional programming style if that’s your thing (I personally find that sometimes the conciseness of functional programming actually makes code harder to read; less isn’t always better).

I think my favorite part of the language is extensions, which allow you to (appear to) add new methods and properties to existing classes. There are certain patterns and behaviors that I often leverage in prototypes, and it’s really useful to add them directly to classes rather than working with utility classes or other workarounds.

Kotlin’s interoperability with Java makes it fairly easy to get productive with the language. I spent a few days reading the book in my spare time, and then pretty much jumped immediately into building the prototype. Often the hardest part of getting productive with a language is learning what libraries are available and how to use them, and with Kotlin (at least for Android development) your knowledge of existing libraries transfers pretty directly. There’s still some learning required to pick up Kotlin’s libraries for collections, strings, etc., and it’s standard functions, but they can be added incrementally as you slowly transition from Java libraries to Kotlin libraries. There are a variety of Android Kotlin extensions as well, but you can similarly work them in incrementally as you learn them (like I said, extensions are one of the best parts of the language).

So less than a week and I’m already productive in the language. For now it’s pretty much all been upside, so I plan to stick with the language for now.

From → Software

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: