The Train to Kotlinville is Leaving, Are you on Board?

Kotlin has been getting a lot of attention recently, since Google announced that it would be making Kotlin an official Android Platform language at IO ‘17. For many, myself included, this has put to bed any doubts about the future of Kotlin and it’s longevity. If you’ve been waiting for the opportune moment to learn Kotlin, now would be a great time.

What is Kotlin?

Kotlin is a statically typed programming language for building modern, multi-platform applications. It was launched in 2011 by JetBrains, the company behind Intellij and Android Studio, and has grown exponentially over the last 5 years. It’s used in frameworks like Spring and Gradle, and in the products of big companies like Pinterest, Evernote and Atlassian. If you’ve never used Kotlin before, you may be wondering what all the hype is about.

Kotlin Hype

Kotlin has a number of language features that make it a compelling language choice. Kotlin reduces the number of NullPointerExceptions in your code, by explicitly making you define your variables as nullable or not. It supports immutable values (vals) which support optimization of code (since the compiler can be certain the value cannot change), and makes it easier for other developers to read your code (knowing that values cannot change).

Get more development news like this

Speaking of readability, Kotlin does away with a lot of the useless boilerplate syntax that litters Java code and makes Java harder to read – things like type inference, first class functions which can replace anonymous inner classes, and optionality of semicolons. It also adds a few things to make your code more readable and expressive, like named arguments, default values, and operator overloading.

One of my personal favorite features is the ability to provide extension methods on classes. Ever wish you could add methods to final classes like String? With Kotlin this is super easy:

String.funName(){/*Custom Function now on all strings in your app*/ }

This is just the tip of the iceberg. There are a ton of additional features that make Kotlin a much better choice over Java, way too many to learn about in a single post. Thankfully the Kotlin ecosystem is rich with a lot of great resources to get started, so I’ve summarized some of the best resources here.

Resources

Official Books

The two most popular books for learning Kotlin are:

I have a copy of the Kotlin in Action book and what I like best about it, is that it has a well rounded coverage of Kotlin, including usage outside of Android. It should be noted that Kotlin is not an Android specific language and Android is not the sole target. Kotlin is a general purpose language that can run anywhere Java can, server or client. Kotlin can also be targeted to JavaScript, transpiling to JavaScript, or even compiled to run on iOS with Kotlin Native.

Kotlin Playground

As you’re learning, try.kotl.in is a great place to go to just try out some code; see what works and what doesn’t. You can type code in free form, or get starter snippets from a variety of sources right in your browser.

kotlin-org-screenshot

It’s even integrated with the Kotlin in Action book, so if you’re going through this book, you can find all of the examples, broken down by chapter and section. You can change the code, tinker, and learn by exploring the content.

Community

User Groups

Chances are there is a Kotlin User Group near you which you can find by going to the Kotlin community page and looking for your city name. If you don’t have one nearby, consider starting one! It’s actually much easier than you would think. Jetbrains has instructions posted here. If you’re interested in a user group, it’s likely others in your community would be too. Take the first step to making that happen!

User groups are a great way to learn and share knowledge with others, in a low pressure way.

Study Groups

Study groups are another great way to learn with others. This helps you and others learning Kotlin to stay accountable and on track. In my town, there is a group of us which meet every Thursday at a local coffee shop. We call it Kotlin & Coffee. It’s been a huge help in our journey to learn Kotlin.

Starting a study group is super easy to do. A great place to find people to study with is your local GDG or Kotlin User Group.

Slack

Jetbrains has an official Slack team kotlinlang.slack.com. It’s free, anyone can join the group and it’s a great place to get answers to your questions, usually within seconds of asking, from other enthusiastic members in the community.

kotlin-slack

Online Learning Resources

There are many online resources that can help you get up to speed quickly, such as Pluralsite, Udemy, Castor.io and others. If you’re learning Kotlin to use with Android, Caster.io is a great option, because their video lessons are targeted to Android developers.

You can also learn a lot about Kotlin in a structured way, right here in the Realm Academy! At Realm, we spend a lot of time curating the best content and speakers to save you time on our path to learning. Here you can find the most relevant talks and content to take you on the path to Kotlinville! Be sure to check back frequently too for updated content.

Conclusion

It’s a revolutionary period for Android development, which is maturing by leaps and bounds from the tools, libraries, frameworks we use, to the growing developer base and new apps being built. Kotlin is a big part of this growth and with support from Google it’s here to stay. It’s a train you most definitely don’t want to miss. Welcome to Kotlinville!

Next Up: Kotlin in Depth #2: A New Hope in a Java 6 Wasteland

General link arrow white
`

Eric Maxwell

Eric is an Product Engineer at Realm. He has spent over a decade architecting and developing software for various companies across different industries, including healthcare, insurance, library science, and private aviation. His current focus is training, mentoring, and mobile development. He has developed and taught courses on Java, Android and iOS. When he’s not working, he enjoys time with family, traveling and improv comedy.