Weex: Review and Comparison with React Native

447 阅读6分钟
原文链接: applikeysolutions.com

In the last year, React Native - a truly brilliant creation of the Facebook team - has become one of the most discussed frameworks for cross-platform development. This is not surprising: applications created with RN have a completely native look (in comparison with hybrid ones, such as Ionic, ExtJS or NativeScript) and, in addition, their speed is not limited by the browser wrapper.

All these advantages have attracted tens of thousands of developers. This is understandable: we all strive to reduce the costs of mobile software without compromising performance. Thus, the factors listed above have made the given framework a kind of "breakthrough" in the field of mobile development and, in fact, encouraged its creators to continue perfecting it (you may remember the sensational React Fiber core algorithm, which demonstrated a qualitatively new level of performance in apps with capacitive animation).

weex review

Up to a certain point, there were no actual rivals. We could not find something as fast and easy to use, which could also boast an arsenal of tools to create cross-platform software. This situation lasted quite a long time until the team of developers behind the Chinese eCommerce giant - Alibaba - started developing their own project called Weex. One of its grand benefits is its complete compatibility with VueJS front-end framework.

In this article, we will discuss whether this framework has succeeded in becoming an efficient cross-platform framework and why many developers consider it a worthy competitor to the super-advanced and rapidly growing React Native.

Weex vs React Native: Analyzing the Key Features

So what kind of beast is Weex? Let’s find out by considering the list of its primary features.

Versatility

Weex is based in Apache Incubator (a project designed to support the development of open source software solutions and further integrate them into the Apache Software Foundation) and sponsored by the Chinese eCommerce vendor, Alibaba. Weex creators employed the slogan of the Java language - "Write once, run anywhere." In practice, it suggests that, with Weex, developers are able to create web applications (based on HTML5/JS/CSS3), as well as applications for Android and iOS platforms, using the same codebase. In particular, a unified codebase allows for accelerated development processes of the application several times (not to mention a faster assembly process). Moreover, this simplifies testing procedures.

As for native components, Weex suggests using ‘weex.config.env’ and ‘WXEnvironment’ interfaces, which allow the simple attachment of such modules to the JS code. React Native operates on the same principle, allowing developers to combine JavaScript with the native components in Objective-C/Swift/Java/Kotlin/C++.

React Native is inherently as universal but, unlike Weex, it generally does not rely on HTML5, instead supplying the SDK for JS. RN allows users to create the most of the application in JavaScript (including dynamic content, in the context of web applications), and the rest of the app (for example, an interface design that has its own unique characteristics at each of the intended platforms) - in a native language.

Ease of Learning

To get started with Weex, you don’t need to know much about it. If you have ever tried to create an HTML page, working with Weex will seem pretty standard. To appreciate this advantage, you do not even need to download any large files - just visit the Weex site. There, you will find the editor, where you will write VueJS-like code. For further tasks, you will need to download Weex SDK or install the Weex Playground App. The only requirement for a simple entry into Weex is a basic knowledge of Chinese, as most of the documentation for this framework is still in its native language. Of course, you can use an interpreter, but, as practice shows, in the case of the Sino-Tibetan language family, the literal translation often turns out to be extremely "clumsy."

What about React Native? Its documentation is clear, detailed, and available in English, and all of your initial attempts at writing code can be just as simple. Do you want to familiarize yourself with the capabilities of this framework without installation? Just read this helpful Github material.

Provision of Native Components

On all the supported platforms, Weex employs browser renderings. In addition, it contains a number of tools that allow for creating a basic UI functionality, easily. All these tools are presented in a form of HTML code fragments. Note that some of them can be customized, and this, in turn, provides additional flexibility (which in most cases is not common to a number of other template development environments).

In the case of React Native, in our opinion, this framework offers a much richer assortment of widgets, APIs and other ready-made tools for the creation of functionality. Furthermore, if necessary (namely, in the absence of convenient ways to implement the required functionality in RN), you can easily connect third-party solutions.

Two-Way Data Binding

Weex, as well as Angular, is familiar to many developers and supports two-way data binding. What does this mean, in practice? Two-way data binding allows changes in the user interface to be directly reflected in the app’s logic, and vice versa. This will involve consuming more resources from the mobile device (memory, battery power) but, within the app, it provides a greatly increased responsiveness to user requests. The benefits of two-way data binding do not end here. Such synchronization of UI and data allows developers to ensure the expected behavior of the created software.

The React Native employs one-way data binding of the "parent to descendant" format. What are the advantages of this approach? It bears the risks of the less unambiguous behavior in code structures, although, for the sake of fairness, we should note that it also simplifies the coding process. If you want to implement two-way data binding in RN, however, the way to do this is provided in the following tutorial.

Visual Rendering

Instead of standard HTML rendering, Weex practices rendering with special components in XML format, which is automatically translated into native code. This allows speeding up the process of refreshing graphic elements.

What is different in React Native, in this respect? At first glance, repetitive rendering can slow down the application. Nevertheless, to eliminate this disadvantage, RN was recently outfitted with a new React Fiber core algorithm that allows accelerating the responsiveness of the visuals in the mobile software and reducing the lags when displaying high-speed animations (60 FPS) down to 16 MS.

Support for Front-End Frameworks

Weex has its own tools to implement rendering. UI is represented in Weex by a separate visualization layer; therefore, in order to create a front-end, the creators of Weex provided built-in compatibility with such frameworks as VueJS and Rax. In particular, the former is a well-known JS framework which was purposefully designed for the creation of front ends, as an alternative to AngularJS that is harder to master. Everything about this would be great, but, until recently, there were no universal algorithms for creating native applications with VueJS - at least until Weex appeared. Thus, it was Weex that solved the problem of developing full-stack cross-platform software with Vue.

Nevertheless, the prospects of Weex are not limited to Vue and Rax. If you want, you can use any other third-party solution by connecting it through the ‘JS-native’ bridge.

In the case of React Native, things are somewhat different. It provides not only an extremely large SDK, which can be used to create UI, but also allows very simple integration with solutions of other software vendors.

Drawbacks of Weex

Now, to complete our Weex review, let us uncover its shortcomings.

Relatively Low Prevalence

At present, there are not many Weex-based projects. As a rule, they originate from China (not a big surprise, right?); however, given the size of the population in this country, we may come to the conclusion that Weex-based solutions have a possible audience of about a billion mobile gadget users. It is this factor that directly affects the rapid development of this framework and its individual components.

If you ask our team, the position is unambiguous. Developers of Applikey Solutions are looking forward to the day when the Weex core codebase is finally released publicly, and they will be able to fully evaluate its features in comparison with other popular frameworks for cross-platform development (React Native, anyone?). Of course, there is also the problem of documentation. We would really like all Weex tools to have properly detailed documents, which would supply a minimal entry threshold for developers whose native language is not Chinese. We also look forward to the expansion of the English-speaking online support community, which would discuss typical problems in a language that is understandable to many.

Imperfect Toolset

Despite the fact that VueJS and Rax are rightfully considered proven and time-tested solutions, Weex itself is still in development. It will not take that long until this framework will become a completely independent and holistic tool for creating cross-platform software, but, so far, we can not recommend it for the development of commercial projects.

Is Weex Production Ready? A Summary

So, what can we say about Weex? This is a fairly handy JavaScript framework, roughly speaking - a Chinese analog of React Native within the VueJS ecosystem. Weex can be called a universal solution that allows for combining the JavaScript code describing the main functional (logic) of the application with native modules and user interface in HTML/CSS. But this is not all. Thanks to this framework, developers can get access to the user device APIs directly from the JS code, thus simplifying access to such platform-specific functions as the camera, GPS, phone book, device storage, etc.

If we compare React Native vs Weex, however, the latter is still "raw," immature and not ready for full use. In addition, it has a much more modest online community and, so far, there are no such advanced tools as RN. Of course, over time, they will certainly appear, and it is likely that they will help Weex to oust React Native. Stay tuned for future news to watch this evolve!

If you have an idea that would entail creating a cross-platform solution that is scalable and easily maintained, you definitely cannot start without the help of professionals. To get a detailed consultation on your project, fill in this form and our experts will immediately get in touch.