Small programs are now the talk of the town, and countless people outside the industry have ambitions to take advantage of it and dominate it for generations to come. This proves once again that what wechat wants to make popular, can be popular. This ability is estimated to be unparalleled in the country at present…

Well, without further ado, let’s get to the point. As a man to become a successful person, using the National Day of the time, I took a good look at the micro channel small program, found that many comments on the Internet for micro channel small program speech, in a certain range of misunderstanding. For the rest of the content, I assume that you already have a preliminary understanding of wechat applets, if you do not, please move on to developing documentation, and then come back to read this article.

First, the applets are not Html5

On this point, the online controversy is actually quite big. Initially everyone’s cognition is one-sided that wechat small program is to use Html5 to develop, and then when the small program really out, we found that the original small program with Html5 is just more similar, but the specific rules and writing has some differences, such as:




The code directory of the applet

Above is the code directory of a small program with suffixes WXML, WXSS, and JS. However, wechat’s full definition of WXML is not Weixin XML, but Weixin MarkupLanguage, which is very domineer to have its own sense of system. Natural WXSS is also WeiXin Style Sheets, with the same hope to make people feel awesome.

The following is an example of WXML that extends the curly brace template over earlier XML.




WXML sample

At this stage, some of the simple students began to be messy, so there is another opinion, that is, wechat applet is not Html5. Well, I have to admit, I struggled at one point, and you see, it just goes to show how naive I am. But after more in-depth analysis and research, I want to express a point of view,

At the same time, through the analysis of the running principle of small program, wechat small program is actually Html5 in essence, the development process of small program will use a lot of Html5 related technologies, but not all use Html5 development. Front-end engineers with HTML5 experience will learn wechat small program development relatively easier. Wechat applet does not need a standard browser kernel that fully supports HTML5 features to run, but it can also run on a browser that fully supports HTML5 by adding some auxiliary facilities.

For more information on how to make your app run on a browser that fully supports HTML5, see Making your wechat app run on Chrome.

Since the essence of wechat small program is Html5, why does wechat take so much trouble to package into what we see now? As a product wang, my occupational disease broke out instantly, and is terminal, there is no cure. From my own humble extrapolation, there are two possible reasons:

The first reason is to borrow a view of many online product people, that is, wechat needs to transform developers through this method, these developers will gradually evolve into the “wechat OS platform” loyal developers. Developers often suffer from “Stockholm syndrome”, where once they have invested their intellectual resources in learning a platform, they start to subconsciously maintain it (i.e., they don’t see the disadvantages of the platform and only see the advantages of the platform). If HTML5 is used as a development method, the developers currently gathered by small programs are just for traffic, without the extra learning cost and lack of loyalty to the platform. Of course, it is impossible to evaluate whether this inference is correct, but it is a matter of different opinions.

The second reason is inferred from the optimization of the technology. As we all know, IN the short term, Html5 still has performance flaws that can’t be ignored compared to native apps. Therefore, it is also possible that wechat completely reconstructs a built-in parser (similar to NodeJs) to optimize performance and remove the parts that have a large impact on performance and are not necessary to exist, so as to achieve a comprehensive solution. If this is the case, it will no longer lead many developers to directly use native Html5 technology to implement small program development. Instead of falling into a variety of Html attributes, features do not support the teasing sound, it is better to directly start is one cut, that is, to avoid trouble, but also in line with their new product positioning and needs. Of course all this is just my personal opinion.

The third reason is that some technology gurus infer from the perspective of technological breakthroughs. For example, perhaps the applets are not a B/S structure at all, but a C/S structure. Many people don’t understand why C/S applications can also be used point-of-use without installation. In fact, this is not wechat’s initiative, the initiative is a technology called streaming applications (please visit Baidu for more details). As long as it is a dynamic language, with the right algorithm, you can download part of the program and run it, and then use it as you go, similar to streaming media. I personally think this is unlikely, because I am curious if this is the case, how will wechat manage the space occupation of small programs?

Well, the analysis here to tell a paragraph first, mainly I have taken medicine, the product wang’s occupational disease has been effectively contained. Looking back at the questions we asked at the beginning, we can conclude very clearly, based on what we know so far:

Wechat mini program is essentially Html5, or an optimized Html5.

As for the micro channel why do so, I believe that with the micro channel small program test account further open, we can also understand more and more information, then have the opportunity, I continue to make some superficial analysis for you.

Second, mobile websites or WebApps can be directly transformed into small programs

In fact, the reason why we retain this understanding is mainly due to the secondary development experience of wechat public number in the past, which largely gives many of us preconceived ideas.

However, through the first problem we analyzed above, we can know that wechat small program is in essence Html5, but in fact it is a kind of optimized Html5, which means that the vast majority of mobile websites or WebApp directly transformed into small program is very difficult, because there are a lot of content to rewrite. For example, the JS script logic of the page is run in JsCore. JsCore is an environment without window objects, so you can’t use Windows in scripts, so you can’t operate components in scripts, which means that zepto/jquery frameworks can’t use any of them.

In my opinion, in a considerable part of the case, an EXISTING HTML5 Page has been written before, and can not be transformed into a legitimate small program Page through automatic conversion tools, and need to have engineers according to the HTML5 Page function, using the framework of wechat small program to achieve again.

Bosses may think that the mobile web site on or before the WebApp simple change in the number of public can access a small program, and then quote us the time limit for a project for engineers do not understand, the engineers can transfer it to the boss see, small program is equivalent to an App to do, from the development, design, testing, and is a separate set of operational upgrade. Oh, you also have to add learning costs and risks, such a new thing to do a quick possibility is really uncertain, after all, small program is still in the testing stage…

Third, the learning cost of developing small programs

In this regard, as I mentioned earlier, it is relatively easy for front-end engineers with HTML5 experience to learn the development of wechat applets. When I was doing a small case, I could clearly feel that the overall design of the small program Page has an obvious “reactive” programming style. I believe that students with experience in vue.js, angularJS and Reactive. Of course, there is no way to test performance on mobile phones because there is no internal testing qualification, so it is not clear whether the framework for applet has any of the performance problems common to reactive programming. Set a small goal after the open beta. Let’s say we write a list with hundreds of thousands of entries and see if scrolling doesn’t flow smoothly.

Considering that the official example of wechat is really very simple, except to help you understand the basic project structure, other significance is not great, so I made a simple example at random here for your initial reference. Because it is too simple, so I did not put Git, directly use the form of web disk for everyone to download it. Download link




Applets example

Fourth, concluding remarks

Finally, the title of the article. Okay, I know that’s a pretty lame title. Before the micro channel small program is not fully open, I may be the same is not awake, maybe the last dozen face hit the ring. These days, as the saying goes, anything is possible…

But anyway, as a technology enthusiast, as a product wang, I will still go farther and farther on the road of no return of technology and products. There is time and if you can support, the next article I want to introduce you to the development process of wechat small program, need to pay special attention to several points.

Well, that’s all for the hydrology record this time, by the way, for an advertisement. If you think this article can bring you a little help, then I would like to ask you to help me a little. Click the link of Suke.com, and then enter the platform to register an account (mobile phone, email or a third party login is ok). If you have time to experience our products in the future, I will be even more grateful if you can give me some valuable suggestions. Fast course network is a platform focused on the construction of mobile teaching courseware, has reached angel round, we sincerely invite you to join the technical gods and operational bull.