Home News Meta’s Android app switches to Kotlin programming language, it works better than...

Meta’s Android app switches to Kotlin programming language, it works better than Java

0

Facebook’s parent company, Meta, has revealed that it has migrated from Java to Kotlin, a younger programming language that also relies on the Java Virtual Machine (JVM), the language used to develop Android apps.

Created by software tools maker JetBrains, Kotlin debuted in 2011, with version 1.0 released in 2016. The following year, Kotlin was adopted by Google as the first class (supported) language for Android development and was placed under the management of its own foundation, funded by JetBrains and Google.

Prior to this, most Android apps were written in Java. in May 2019, at its developer conference, Google began encouraging Android developers to favor Kotlin over Java. at the end of that year, Google said that 60 percent of the top 1,000 Android apps contained Kotlin code.

Google’s reasons for recommending Kotlin were that it was cleaner, more secure, supported structured concurrency, made asynchronous code easier, and could interoperate with Java. But this may also have something to do with Java manager Oracle, which spent more than a decade bringing infringement claims against Google over the Java API used in Android (and ultimately lost).

Meta also seems to be interested in Kotlin, with Facebook software engineer Omer Strulovich saying they’re already replacing Java code with Kotlin in several of their popular Android apps, including Facebook, Instagram, Messenger, Portal and Quest.

Kotlin is generally regarded as a better language than Java, and in the annual Stack Overflow developer survey, Kotlin is rated higher than Java,” Strulovich said, noting that Kotlin has become a popular language for Android development. He notes that Kotlin has become a popular language for Android development, “so it makes sense for us to move Meta’s Android development to Kotlin.”

But beyond its popularity in the Android ecosystem, Strulovich acknowledges that it is still far less popular in the broader market than Java, which is the second or third most popular language in the world.

Kotlin’s advantages over Java include built-in nullability handling, support for inline functions and lambda expressions, shorter code, and the ability to define DSL (Domain-specific language). The downside is that you have to deal with a mixed code base for a long time, it’s harder to maintain, and Kotlin has been around for a shorter time than Java and has a less mature set of tools.

Today, our Android apps for Facebook, Messenger and Instagram all have more than a million lines of Kotlin code, and the conversion rate is growing,” Strulovich said. In total, our Android codebase has more than 10 million lines of Kotlin code.”

Strulovich did not say when Meta began this shift, or what percentage of its Android app code is converted.

Strulovich added: “On average, we’ve seen an 11 percent reduction in the number of lines of code for this migration. And there’s no performance regression, so at least the converted apps have maintained their original performance.”

Strulovich said the Meta migration is underway and accelerating, but he also said, “Kotlin still lacks some of the tools and optimizations we’ve become accustomed to in our work with Java. But we’re working hard to close those gaps. As we make progress and these tools and libraries mature, we’ll work to put them back out to the community as well.”

Exit mobile version