Five years later, Google is still ready for Kotlin – TechCrunch

It’s been just over five years since Google first announced that it would make Kotlin, the statically typed language for the Java Virtual Machine first developed by JetBrains, a first-class language for writing applications. Android at Google I/O 2017. Since then, Google has gone one step further by making Kotlin its preferred language for writing Android apps in 2019 – and although many developers still use Java, Kotlin is quickly becoming the default way to write Android apps. create applications for Google’s mobile operating system. In 2018, Google and JetBrains also teamed up to launch the Kotlin Foundation.

Earlier this week, I sat down with Google’s James Ward, the company’s product manager for Kotlin, to talk about the language’s role in the Android ecosystem and beyond, as well as the company’s future plans.

It’s no surprise that Google hopes that over time all Android developers will switch to Kotlin. “There’s still quite a bit of Java on Android,” Ward said. “We know that developers are generally happier with Kotlin than with Java. We know they are more productive, the quality of applications is higher, so we aim to get more of these people moving more of their code. Kotlin Interoperability […] with Java has made it so people can kind of move the codebases incrementally and it would be great to get to the point down the road where it’s all Kotlin.

Advertising

We’re not there yet, however, partly because the Java ecosystem is so large that it still has a lot of gravity. Due to Kotlin’s interoperability with Java, developers can mix and match libraries, but to get the full benefits of Kotlin, developers must stay within the Kotlin ecosystem. And despite all the attention to Kotlin, it’s worth noting that the core of the Android platform and its APIs are still built on top of Java. There are now a handful of Android libraries that are written in Kotlin, but that’s obviously still just a small part of the overall platform.

But Kotlin today is also so much more than Android. Server-side Kotlin is becoming quite mainstream at Google at this point, it seems, with over 8.5 million lines of Kotlin code in Google’s internal code base to date. That number, the company said, is now doubling every year.

It turns out that Google and JetBrains have been hard at work rewriting the Kotlin compiler from scratch for the past few years. This new compiler, which promises to be faster and offer better interfaces to allow IDEs to improve features such as better code hinting and static code analysis, is now in beta and will likely be delivered next year. Since the company has put quite a bit of resources into this project – and currently maintains two compilers in parallel – this means that development of the language itself has slowed down a bit.

“We intentionally slowed down the rate of change in the language because we have the two compilers in parallel,” Ward said. “Once we ship the new compiler and everyone gets on board, we can invest more in new language features. »

Among these new features are context receivers, which are currently always behind a flag. These will allow developers to pass parameters to a function to, for example, only write part of the code and values ​​to connect to a database once and then use that same context again every time you need to establish that connection again.

As for the Kotlin Foundation, it’s worth noting that so far only Google and JetBrains have been members here, and both companies use the foundation to coordinate their investments in Kotlin. But Ward explained that the two companies are looking to expand the foundation with new members. “We have a plan to expand beyond that,” he said. “This is essential to the growth of the Kotlin ecosystem: to grow the Kotlin Foundation beyond the two companies that are its founding members. He noted that the two companies don’t yet have a reason to put the Foundation under an organization like the Linux Foundation, in part because with two members it would have been overkill, but that could change. as Google and JetBrains attract more members over time.

Leave a Comment