In the last few years Kotlin has steadily grown in popularity across the Android community. Finally, we have an interoperable replacement for Java with modern language features and brevity. Dan Lew summed it up nicely in his recent blog post “the many myriad Kotlin features enable more concise and understandable code than Java without sacrificing performance or safety.” We have been developing with Kotlin for several months and were very excited at this year’s Google I/O announcement that Kotlin will now be officially supported for Android. What does that mean for ongoing projects and the depth of Java talent you have on your team? Christina Lee gave an excellent talk at I/O discussing how best to introduce Kotlin at your company. We’d like to share our approach to adopting Kotlin and supporting our team.
One of your first steps should be to define some guidelines around how a developer can determine if they should be using Kotlin or Java. Any decision to use Kotlin should involve a discussion with the team, client, and other potential maintainers. Here’s a brief example:
- New project -> use Kotlin!
- Maintenance on existing Java code -> Probably not the best time to convert
- Fixing bugs in Java code -> Nope, just fix the bugs
- New features in an existing app -> This should be evaluated independently, but likely yes
- Rewrite consumer apps -> No, don’t fix what isn’t broken
- Rewrite internal apps -> This is usually a good candidate for experimenting with Kotlin
It is important to set your team up for success by providing resources that are applicable to your projects. You should start by creating a style guide using the Kotlin coding conventions as a reference. Even if you are unfamiliar with Kotlin, this is a good way to start the discussion and get some consensus from your team. The style guide should also include an organized list of online resources to help developers getting started. You may also want to consider creating a sample project that follows the style guide and uses technologies that are common for your projects.
Now that you’ve created a solid support framework, it’s time to go the extra mile. Be the Kotlin evangelist at your company, promoting it at every meeting. In retrospective and team meetings, talk about successes with the language and find examples where it was more efficient or avoided bugs that would have been harder to do so with Java. Create a #kotlin Slack channel to open communications and promote discussions. You can also use Slack to send a daily or weekly Kotlin tip that shows off language features and educates developers.
Of course every development team is unique and it may not be best for your team to migrate right now. Once you’ve established a core group of Kotlin developers and their expertise grows, the remaining barriers to adoption should begin to fall. Hopefully, these tips will help you bring your team on board the Kotlin train.