Meta has found a programming language you prefer better than Java • The Register

Meta has found a programming language you prefer better than Java • The Register

Meta, the parent company of Facebook, is in the midst of migrating Java code for an Android app to Kotlin, a younger programming language also based on the Java Virtual Machine or JVM.

Created by software tool maker JetBrains, Kotlin debuted in 2011 and by 2016 reached Version 1.0. The following year, it was certified by Google as First class language (supported) for Android development and put under the management of his own organization, funded by JetBrains and Google.

Up until that point, most Android apps were written in Java. In May 2019, at the developer conference, Google began to encourage Android developers Favor Kotlin on Java. By the end of the year, a giant search He said 60% of the top 1000 Android apps contained Kotlin code.

The rationale for using Google Kotlin is that it is more concise, more secure, and supports structured concurrency for easier asynchronous code, and is interoperable with Java. It may also have something to do with the Java steward Oracle, which has spent over a decade pursuing (And lose in the endAn infringement claim against Google regarding the use of Java APIs in Android.

Kotlin appears to be similarly intriguing to Meta, and as Facebook software engineer Omer Strulovich has explained, social advertising has turned VR high roller Java code in many popular Android apps – Facebook, Instagram, Messenger, Portal and Quest – has been replaced by Kotlin.

As befits a company founded as a social network, Meta wants to hold out with the popular audience.

Kotlin is generally considered a better language than Java, with preferential ratings higher than Java in annual Stack Overflow Developers Survey,” Strolovich said, noting that Kotlin has become a popular language for Android development”[s]o It only makes sense that we switch our Android development in Meta to Kotlin…”

But regardless of its popularity in the Android ecosystem – which Strulovich admits in the broader market is below Java, somewhere in the top three programming languages ​​depending on who you ask – Kotlin has some practical advantages.

These include: nullability , to help avoid null reference errors by supporting types that cannot contain a null value; Support for functional programming via inline functions and lambda expressions; More concise code and support Domain specific languages (DSLs), scope-limited programming languages ​​for certain tasks.

The transition also had drawbacks. Mixed code bases can be hard to maintain, and Kotlin, which has been around for less than Java, has a less mature set of tools. Redex, Android bytecode optimizer for Facebook, needs to be updated. So did you dwarvesSyntax highlighter. Also, some of the internal libraries didn’t work for bytecode optimization during compilation with Kotlin and had to be updated. And new tools like suffocateThe Kotlin hyperbolic coordinator had to be built.

Our Android apps for Facebook, Messenger and Instagram have more than 1 million lines of Kotlin code, and the conversion rate is growing

Meta could have decided to just write new code in Kotlin but instead chose to convert all of its Android apps.

“Today, our Android apps for Facebook, Messenger and Instagram contain more than 1 million lines of Kotlin code, and the conversion rate is increasing,” Strolovich said. “Altogether, our Android code base contains more than 10 million lines of Kotlin code.”

Strolovich did not say when Meta began this transformation – the company’s developers discuss Kotlin widely used at last year’s conference – or the percentage of Android app code converted. record Ask Meta for more details.

Ten million lines of Kotlin in this transition, Meta realized some benefits. For example, even though the Kotlin code is shorter, it’s probably not as much as hoped for.

“On average, we saw an 11 percent decrease in the number of lines of code from this migration,” Strolovich said. “We’ve seen much higher numbers reported online, but we suspect these numbers are derived from specific examples.”

Part of the frustrating code reduction is that a lot of the application code that gets compiled consists of UI definitions, which stay the same whether they’re in Java or Kotlin.

Strulovich also said that there is no speed gradient, so at least switched apps have maintained their performance. Build volume for Kotlin applications has also not proven to be a problem, although build times have suffered – this was to be expected because Kotlin assembly has not received as much attention as Java assembly.

Strolovitch said the migration of the meta is continuous and accelerating. Meanwhile, the popularity of Java, according to at least one measure, has to reject 4.7% in the past five years.

“Kotlin still lacks some of the tools and improvements we used from working with Java,” said Strolovich. “But we are working to fill those gaps. As we make progress and these tools and libraries mature, we will also work to give them back to the community.” ®

#Meta #programming #language #prefer #Java #Register

Leave a Comment

Your email address will not be published. Required fields are marked *