Techno Blender
Digitally Yours.

From Java to Kotlin! Did Meta Change Codebase to Compensate for Losses?

0 52


What made Meta’s developers move their codebase from Java programming language over to Kotlin?

In recent years, Kotlin has become a popular language for Android development. So, it only makes sense that Meta would shift its Android development to Kotlin as it works to make the development workflows more efficient. Meta’s Android repository is very large and reaches across its family of apps and technologies, including Facebook, Instagram, Messenger, Portal, and Quest. Shifting away from Java, which Meta currently uses for Android development, and over to Kotlin is not a trivial task.

 

Why did Meta change codebase to Kotlin?

Kotlin is generally regarded as a better programming language than Java, with higher favorability ratings than Java in the yearly Stack Overflow developer survey. Meta also compared the latest Kotlin version with Java 11, which is the latest version that can be used for Android development.

Aside from its popularity, Kotlin holds some major advantages:

  • Nullability: Null pointer exceptions are a common problem at Meta, as everywhere else. The company is very good at fixing them before releasing its apps, but dealing with those issues is still time-consuming. Meta uses internal tools to detect null safety issues earlier, and rigorously annotate its code as part of the work to detect such issues in Java earlier. But even with that, Kotlin’s built-in nullability handling is more robust and easier to work with.
  • Functional programming: Kotlin’s support for inline functions and lambda expressions allows us to use a functional programming style without compromising execution speed. Although Java 8 adds support for lambdas and is available for Android, it comes at the cost of more anonymous objects, which affect performance negatively on low-end Android devices. Meta’s home-brewed Redex minimizes these issues, but they still exist, making Kotlin a better alternative.
  • Shorter code: Kotlin’s modern design makes its code shorter. Kotlin allows for dropping explicit types (as does Java 11), and together with the standard library, which is based on the functional style mentioned above, it shortens many repetitive loops into simpler statements. This shorter code is also more explicit, which can make it easier to follow.
  • Domain-specific language (DSL) / Type-safe builders: Kotlin’s various features come together and let us define a DSL. Basically, a way to move definitions such as Android XMLs to be implemented directly in Kotlin code. But this tool should be wielded carefully because implementing DSLs in Kotlin can either be useful or turn into over engineering.

 

Why Kotlin is better than Java?

All Java libraries and development frameworks are perfectly compatible with Kotlin. This makes it easier for Android app development companies to smoothly switch to Kotlin from Java. If you are an Android developer, you can easily use Kotlin without making any major changes, such as converting an entire project in terms of coding. This is, in fact, one of the biggest advantages when it comes to time and efforts associated with changing the existing coding language. Besides, the simplicity of Kotlin makes it incredibly easy for developers to learn and code. If you are familiar with Java, you can easily write codes in Kotlin. Also, you can easily convert Java codes into Kotlin. You just need IntelliJ or Android studio, and you’re good to convert Java to Kotlin. That’s why so many Android development projects are being shifted to Kotlin.

The post From Java to Kotlin! Did Meta Change Codebase to Compensate for Losses? appeared first on Analytics Insight.


From-Java-to-Kotlin!-Did-Meta-Change-Codebase-to-Compensate-for-Losses

What made Meta’s developers move their codebase from Java programming language over to Kotlin?

In recent years, Kotlin has become a popular language for Android development. So, it only makes sense that Meta would shift its Android development to Kotlin as it works to make the development workflows more efficient. Meta’s Android repository is very large and reaches across its family of apps and technologies, including Facebook, Instagram, Messenger, Portal, and Quest. Shifting away from Java, which Meta currently uses for Android development, and over to Kotlin is not a trivial task.

 

Why did Meta change codebase to Kotlin?

Kotlin is generally regarded as a better programming language than Java, with higher favorability ratings than Java in the yearly Stack Overflow developer survey. Meta also compared the latest Kotlin version with Java 11, which is the latest version that can be used for Android development.

Aside from its popularity, Kotlin holds some major advantages:

  • Nullability: Null pointer exceptions are a common problem at Meta, as everywhere else. The company is very good at fixing them before releasing its apps, but dealing with those issues is still time-consuming. Meta uses internal tools to detect null safety issues earlier, and rigorously annotate its code as part of the work to detect such issues in Java earlier. But even with that, Kotlin’s built-in nullability handling is more robust and easier to work with.
  • Functional programming: Kotlin’s support for inline functions and lambda expressions allows us to use a functional programming style without compromising execution speed. Although Java 8 adds support for lambdas and is available for Android, it comes at the cost of more anonymous objects, which affect performance negatively on low-end Android devices. Meta’s home-brewed Redex minimizes these issues, but they still exist, making Kotlin a better alternative.
  • Shorter code: Kotlin’s modern design makes its code shorter. Kotlin allows for dropping explicit types (as does Java 11), and together with the standard library, which is based on the functional style mentioned above, it shortens many repetitive loops into simpler statements. This shorter code is also more explicit, which can make it easier to follow.
  • Domain-specific language (DSL) / Type-safe builders: Kotlin’s various features come together and let us define a DSL. Basically, a way to move definitions such as Android XMLs to be implemented directly in Kotlin code. But this tool should be wielded carefully because implementing DSLs in Kotlin can either be useful or turn into over engineering.

 

Why Kotlin is better than Java?

All Java libraries and development frameworks are perfectly compatible with Kotlin. This makes it easier for Android app development companies to smoothly switch to Kotlin from Java. If you are an Android developer, you can easily use Kotlin without making any major changes, such as converting an entire project in terms of coding. This is, in fact, one of the biggest advantages when it comes to time and efforts associated with changing the existing coding language. Besides, the simplicity of Kotlin makes it incredibly easy for developers to learn and code. If you are familiar with Java, you can easily write codes in Kotlin. Also, you can easily convert Java codes into Kotlin. You just need IntelliJ or Android studio, and you’re good to convert Java to Kotlin. That’s why so many Android development projects are being shifted to Kotlin.

The post From Java to Kotlin! Did Meta Change Codebase to Compensate for Losses? appeared first on Analytics Insight.

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment