As of 2021, Kotlin is now a generally available language across all of Google. The company first announced in 2019 that it was taking a Kotlin-first approach in Android, but since then it has expanded its support and implemented Kotlin in more than 60 applications such as Google Home, Drive, Maps, Pay, Sheets, and Docs.
“What we have really seen is that our developers love it, and we’ve seen a ton of growth just in terms of usage both outside and inside Google,” said Karen Ng, product lead for Kotlin and Android development tools.
Ng explained the adoption happened organically within the company. Before Google decided to adopt it, the Android community wrote an open letter to the company about Kotlin and its benefits.
After adopting it, Google found it was just easier, safer and more reliable to work with than other languages. For instance, it’s fully interoperable with Java, making it easier for developers and Google to adopt it without having to rewrite a bunch of code, according to Ng.
RELATED CONTENT: The rise of Kotlin
Kotlin also provides safer code by being able to take nullable and non-nullable information into the type system and help developers avoid whole crashes, Ng explained. Google Home was able to reduce crashes by more than 30% with the help of Kotlin.
“The Google Home team decided to incorporate Kotlin into their codebase to make programming more productive and to enable the usage of modern language features like var/val, smart casts, coroutines, and more,” the company revealed in a case study. “Because Kotlin can make nullability a part of the language, tricky situations can be avoided, like when inconsistent usage of nullability annotations in Java might lead to a missed bug. Since the team started migrating to developing new features with Kotlin, they saw a 33% decrease in NullPointerExceptions. Since this is the most common crash type on Google Play Console, reducing them led to a dramatically improved user experience.”
Other features like coroutines were especially important for Google to be able to help mobile apps handle asynchronous data.
Credit: Source link