Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

Compiled by|Nuclear Cola, Yan Shan Recently, Google officially launched Jetpack Compose version 1.0. Following this, JetBrains released the Compose Multiplatform Alpha version, aiming to extend Compose to desktop and web platforms.

Compose Multiplatform consists of Compose for Desktop and Compose for Web, supporting many different platforms through Kotlin Multiplatform. Among them, Compose Desktop uses Google’s Skia graphics library to achieve UI rendering on Windows, macOS, and Linux, providing a unified experience across all supported operating systems, similar to Flutter’s approach.

According to the Kotlin team, compared to the Electron framework, Compose Multiplatform will have more significant advantages in terms of memory consumption, installation size, and UI rendering performance. With the release of the Alpha version, Compose Multiplatform has also gained new Android Studio plugins, including support for displaying component previews in the IDE and many additional features.

We hope this article helps everyone further understand the cross-platform capabilities of Compose and the main driving forces behind JetBrains’ expansion of Compose from Android to these other platforms.

Based on Jetpack Compose 1.0

Jetpack Compose, developed by Google, is the official framework for building user interfaces within Android applications, with version 1.0 just released last week. Meanwhile, the first stable version of Android Studio, codenamed “Arctic Fox,” 2020.3.1, has also officially debuted.

Although it has just reached version 1.0, Google stated, “Currently, there are over 2000 applications in the Play Store using Compose—more importantly, even the Play Store app itself is using Compose.” Google also mentioned, “We have been collaborating with some top app developers, and their feedback and support have helped us make version 1.0 even stronger.”

Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

Compose is a declarative framework, characterized by its departure from the hierarchical structure found in traditional Android methods, or the layout and control tree. The user interface in Compose is defined by writing functions annotated with @Composable (used to describe the screen state), which is known as function-generated user interfaces. The Google Android development team explained, “As the application state changes, your UI will automatically update, making it easier to build UIs quickly.”

Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

Jetpack Compose for Android Welcomes Version 1.0

Compose is developed based on Kotlin, and both Kotlin and Android Studio (the officially designated Android IDE) come from the development tool vendor JetBrains. Although Jetpack Compose is specifically designed for Android (unlike Google’s Flutter framework), JetBrains firmly believes that Compose can achieve cross-platform capabilities.

Compose for Desktop: This is Just the Beginning

Compose Multiplatform can be seen as a port of the framework for macOS, Linux, Windows, and the web, currently just released in version 1.0 Alpha. Although still in the early development stage, JetBrains stated that it has “provided developers with a stable API that can be used safely in basic scenarios.”

The Register inquired with Nikolay Igotti, the head of the Compose project at JetBrains, to understand why the company is developing Compose for Desktop when it already has a widely used cross-platform Java framework for desktop applications in IntelliJ IDEA and its various rich variants. Igotti’s response was, “The old Java frameworks are basically modified versions of Swing. Swing is the default JDK UI framework, along with AWT (Abstract Window Toolkit). Compose is a completely different matter, and we have also considered interoperability needs in the design… Swing is too outdated, having first appeared in the late 1990s. Over the years, the design thinking for UIs has changed dramatically, and Swing clearly cannot meet the requirements anymore.”

Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

Compose for Desktop Project in JetBrains IDE

Compose shares a significant commonality with Swing: unlike other cross-platform frameworks that use native controls, such as Java’s SWT (Standard Widget Toolkit) and Microsoft’s Xamarin, which choose to draw their own controls. The Skia open-source graphics library used by Compose is also widely used in Google Chrome, Flutter, and many other frameworks. Does this mean that Compose applications will lack a native appearance? In response, Igotti stated, “It depends on the developer’s choice and how they set the theme for the application. In this regard, Compose is no different from other frameworks like Flutter.”

Does this mean that Compose for Desktop applications rely on the JVM (Java Virtual Machine) to run? Igotti stated, “We also know that the release of JVM applications can be tricky. Therefore, we provide our own Gradle plugin that uses jpackage and Jlink to create native applications based on JVM applications. This can achieve .dmg for Mac, MSI for Windows, and deb packages for Linux, so there is no need to worry about the JVM.”

In other words, the development output will be a carefully packaged JVM application. JetBrains also has a Kotlin/Native compiler to address this issue, “which is expected to be released in the future, specifically for desktop development.”

Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

A Different Way of Thinking About Applications

What about web applications? Igotti responded, “We use the Kotlin/JS compiler.” The web version of Compose is not as advanced as the desktop version, and the documentation warns that “the API is not finalized and significant changes are expected.” Additionally, while the web version does use the Compose model, the API is entirely different and will use HTML and CSS. Therefore, the code that can be shared between the web version and Compose for Desktop should be quite limited.

According to Igotti, “Compose represents a different way of thinking about applications. The state is the true source of the UI, while the UI itself is stateless, and its expression is always derived from the state. In this regard, Compose for Web adopts the same set of primitives and the same state management approach. However, for specific sets of widgets and layout arrangements, the web version and desktop version cannot interoperate.”

So, why expand Compose for Android to various other platforms? “The target audience for Compose is mainly divided into three categories. First, Android developers using Kotlin and Compose who want to deliver their development results to other platforms; second, pure Kotlin developers who want to develop new applications in a ‘write once, run anywhere’ manner; and third, those who are not very familiar with Kotlin or Compose but want to develop beautiful UIs. We hope to provide them with the tools to achieve their goals.”

Igotti did not provide a specific release date but expressed hope that the Beta version would be released this fall, “and we also hope to launch version 1.0 within this year.” The project itself is completely open-source, “In the 21st century, frameworks should not be charged for most people. We just want to develop a long-missing software,” to fill the gaps in JetBrains’ current commercial model’s toolchain.

It is important to note that Compose does not provide a visual designer. Igotti mentioned, “Most developers do not like graphical UI builders; declarative UI and design content previews are the most popular solutions. Therefore, we provide a preview mechanism where you can add annotations to composable functions and quickly preview without running the application.”

JetBrains believes that the current tool market does not adequately support desktop application developers, and internal developer surveys conducted by the company have confirmed this conclusion to some extent. “Desktop development now feels a bit like ‘second-class citizen’… this is a niche market that needs a lot of attention.”

So, will JetBrains use Compose in its other tools? In fact, their JetBrains Toolbox (for managing installed IDEs) is already using Compose, but Igotti stated that in the short term, Compose cannot replace existing frameworks like IntelliJ IDEA. “The editor is the most complex and important component, having evolved over 20 years, and it is almost impossible to rewrite it halfway. Neither JetBrains nor I personally intend to force everyone to switch to Compose. Our goal is to provide new solutions for users whose existing framework options do not meet their needs.”

In Conclusion

So, why do we need another cross-platform framework besides Flutter? Although Google’s Flutter initially focused mainly on mobile devices, it is now also advancing into desktop and iOS, even ahead of Compose. However, according to the latest StackOverflow survey, the language used by Flutter is Dart; although the popularity of Dart is growing (driven by Flutter), it still cannot be compared to Kotlin.

More importantly, Compose is gaining strong momentum—its GitHub repo has over 5000 stars, and the number of reported issues is also very high. While many issues represent “troubles,” they also indicate that this is a direction that developers are keenly interested in.

Compose represents a unique way of building UIs, and perhaps the audience most looking forward to Compose’s cross-platform capabilities are those developers who have used it on Android and particularly enjoy this UI building experience.

For further information on Compose, domestic Android developers can visit the following link to view the Chinese manual: https://compose.net.cn/

Further Reading:

https://www.theregister.com/2021/08/06/compose_for_desktop_kotlin_framework/

Today’s Recommended Articles Technical Director Sued for 900,000 by Company for Delaying Development Progress? Byte Education Cuts About 90% of Employees, Compensation N+2; Wang Sicong Spent One Million to Assemble a Server, Scoring Fourth in the World; Survey: Clojure Language is the Most Profitable | Q News XML Father: Not Testing Code is Like “Not Washing Hands After Using the Toilet” Why are CEOs with Software Engineering Backgrounds Becoming More Popular? Event Recommendation

Deep learning has achieved many results in personalized recommendations, search technology, data mining, natural language processing, vision, speech, and other related fields. When deep learning combines with app scenarios involving hundreds of millions of users, what practical innovations emerge?

AICon Global Artificial Intelligence and Machine Learning Technology Conference 2021 (Beijing Station) – “General Machine Learning Technology” Special Session Invites industry experts to share their deep learning technologies in app scenarios involving hundreds of millions of users, sharing more updated explorations, practices, and gains based on cloud services and end technologies, focusing on the entire technical chain from business goal modeling, feature design, model training to application estimation, discussing the innovativeness, efficiency, universality, and applicability of deep learning technologies in practical applications.

Conference tickets are currently 20% off, and there is a special event for the Qixi Festival, with an additional 10% discount for purchasing tickets for two or more people. For more details, please contact the ticketing lady: 13269078023 (phone same as WeChat)

Why Do We Need Another Cross-Platform Development Framework Besides Flutter?

Leave a Comment