The original address: ant – move. Making. IO/website/bio…
Here said the removal of small program framework is not rigorous, because the small program itself is also a framework, and is a more complete framework system. In the concept of the front end, we said that a framework is a commonly used to help developers build the user interface framework, and small application framework itself not only contains the function of the UI layer, also provides the API ability, service ability, so small application framework itself is a more perfect than conventional front-end framework, Or a complete build application. All the comparisons between native applets and applets frameworks in this article refer to comparisons with third-party applets frameworks.
In the world of applets, the native applets framework is good enough, it is the chisel that gives you a small and beautiful application without having to look for a dragon slayer.
Choice of framework
A recent Vue author’s share of framework design balance also touched on the issue of trade-offs.
When building a complex front-end application, it takes more time to develop using native JavaScript instead of tools. For applets, the native applets framework is our tool for building a complex applets application.
But is the development environment for Web applications also suitable for applets?
Small program framework did play a great role in the early development of small program ecology. However, with the continuous improvement of the native framework of small program, the role of these small program frameworks no longer has advantages.
Frameworks do bring productivity gains to the front end, as well as the front-end ecosystem. So after the emergence of small programs, a wind of the framework also quickly appeared, wechat small program just launched, there are two relatively famous small program development framework, WEPY, MPVue. The two frameworks have a common starting point, that is to transplant the development experience of the front-end framework into the development of small programs, and make changes from the syntax layer. Users can use the syntax similar to vue.js style to develop wechat small programs.
At the beginning, these small program frameworks mainly enhance the native development experience of small programs. With the development of the small program ecosystem, they also increase the support of cross-end development capabilities. But does the introduction of our framework really enhance the development experience? Do we really need cross-end capabilities? Does cross-end support need to be implemented in the form of a framework?
The answer is no, and introducing frameworks will only create more problems for small program development.
Native applets VS Web frameworks
The following is a comparison of the functionality of native applets and Web frameworks. You can see that Web frameworks have the capabilities of native applets.
Web frameworks were already mature when applets appeared, so it’s easy to guess that applets’ frameworks borrowed a lot of features from Web frameworks, which is why the applets’ development approach is so close to the front-end development approach.
Functional comparison
The module | Vue.js | React.js | Native applet |
---|---|---|---|
Data to monitor | support | support | support |
Component development | support | support | support |
Component library | Open source component libraries are abundant | Development component library is rich | Native applets component support |
Data state management | vuex | redux | GlobalData implements basic data management |
routing | vue-router | react-router | Native support |
Module development | npm | npm | NPM (with slight constraint restrictions) |
When developing front-end applications, Vue and React technology stacks are two popular types. Many developers are not sure which technology stack to choose when choosing ecological tools, so they usually choose Vue family bucket and React family bucket. Small native application framework from the ability to consider the technology needed to stack the small program scene, this is also the author promoting primary development way of small procedures, if you to your current application scenario for the need to build what kind of technology stack is especially clear, then use the native good, for small native application framework is based on the development of the small program scene. What kind of technology stack to choose, what kind of framework capability to provide, this should be the small program platform team to think about.
Advantages of native applets
From the above functional hierarchy comparison we can find that the function of the native small program is very similar to that of the framework. In simple terms, it is the same species, but the difference between the flower cat and the white cat. What are the other advantages of native applets?
- stable
- security
- reliable
Native applets are maintained and updated by professional applets teams, which is unmatched by community open source projects. Even popular open source projects are not guaranteed to stagnate in their maintenance, and one day you may find a bug in your code that you have to fix yourself.
Native applets are still in the stage of rapid development, new features will be released every once in a while. If you use native applets, you can enjoy them in time. If you rely on third-party frameworks, you have to rely on the framework author to update them.
As a developer, sometimes it’s hard to choose a framework, and if you want to choose the right one, you have to understand some of the internal tradeoffs that the framework makes. You have to know where the framework is going, and how consistent it is with what you’re building. For small programs, the above problems actually do not exist, small program framework is small program platform team tailored for you.
To learn more about applets, check out the following three frameworks:
WePY framework refers to Vue and other existing frameworks in the development process of some syntax style and functional features, the development mode of native small program was encapsulated again, more close to the MVVM architecture mode, and support some new features of ES6/7.
Mpvue is a front-end framework for developing small programs using vue.js. It currently supports wechat small programs, Baidu intelligent small programs, Toutiao small programs and Alipay small programs. The framework is based on vue. js, modified runtime framework runtime and code compiler implementation, so that it can run in the small program environment, thus introducing vue. js development experience for small program development.
Taro is a multi-terminal development solution that follows the React syntax specification. Using Taro, we can only write one set of code, and then compile the source code to run on different applications (wechat, Baidu, Alipay, Bytedance, QQ mini program, Kuaiapp, H5, React-Native, etc.) using Taro’s compilation tool.
Applets cross – end requirements
Following the launch of wechat mini program, Alibaba, Baidu and Toutiao also launched their own mini program platforms, which brings a problem to the developers of small programs, whether to develop a set of each platform or to seek technical solutions for code reuse.
Actually across many side solution, most of existing small application framework built across the ability to support, support for across the ability request is not particularly high team, also can build their own solutions across the end, because these small application frameworks are very similar, so structures, a set of specific scenes across the end of the scheme is feasible.
Antmove – Compiled applets cross – end solution
Antmove is a solution dedicated to providing universal applets with cross-terminal, through the means of code compilation and runtime processing, to achieve the purpose of cross-platform applets, Antmove and other applets development framework is different, As far as possible, it tries to solve the problem of multiple differences by means of code compilation (converting code from one platform to another). Only those difficult to deal with by compilation method will be smooth-out at runtime, and this part only has simple data conversion processing, without introducing specific coding constraints.
Taking the transfer of wechat applet to Alipay applet as an example, the underlying design of wechat applet and Alipay applet is different, resulting in different component mechanisms. The communication between wechat applet components is based on events, while Alipay applet is based on props. Antmove does not construct a set of event mechanism to avoid any unnecessary runtime overhead. Instead, it uses the props mechanism of Alipay applet to achieve the same function.