# (Transfer) What is the experience of doing front-end development in 2016?

Some people say, what qualifications do you have to make such a talk, it is actually like this. When I was watching the live broadcast of the lol game, a well-known anchor said that those who hit more than 2400 are going to be professional players, 1800- Those who are still struggling, only those who are hovering around 2000 came out to be the anchor, but this is the case. If you are a very capable programmer, you can control any new technology and framework, then your awesomeness may conceal some real problems. , But some people just turn the problem into a feature.

Many front-end developers are proud to despise jQuery and use jq-free as a boast. This is no problem, because if your target is IE9+, or mobile, the MVVM framework allows you to avoid jq. However, let's consider 2 points. Why do you force users to upgrade IE8 to chrome? Win7 is such an excellent operating system. Computers in Internet cafes and even many office computers are XP. A large number of websites are compatible with IE8. Users are God. Are we qualified to ask God to upgrade the browser for no reason? Many programmers despise 360, but you should really thank 360. 360 uses a relatively gentle way to allow a large number of users to upgrade their browsers with chrome kernel. In contrast, YY is like raping users, so it s not telling in the background. Human activities.

Then let me talk about where JQ is excellent. JQ is not a framework better than a framework, and I hope that every product manager will learn JQ. The usage of JQ is definitely not accidental. First of all, JQ's api design is very good (using$Instead of all selectors, it s an awesome design. Of course, I also need to mention the underscore underscore here). Compared with the reversing fetch, I don t know how high it is. I have also used axios. Axios uses one under get and post. Params uses data. Is this a semantic requirement or a standard requirement? I don't want to care about semantics, because the encapsulation of tool classes is to shield semantic differences and inconveniences, and to be people-oriented. Many people criticize JQ for doing too many things with one selector, but if jq puts$Replaced with jqDOM, jqString, jqSelector, then how many people will use a framework.

Compatibility is not mentioned, jq2 is perfectly compatible with jq1, but some browsers are discarded. It is worth learning by product managers that jq focuses on solving dom operation problems encountered by programmers. By the way, it comes with almost perfect ajax encapsulation and some tool classes, which should be there, and there is almost no extra function. Therefore, before the mobile terminal is not active, many front-ends are jq+ templates to get everything. So, want to criticize jq and make big news?

Next, let's talk about react. I also jumped into this pit recently. No way, ng2 and vue perform poorly on a third-party core component that I need. Even the demo of this component of vue cannot be opened. Star also Was crushed dozens of times. But this does not mean that React is okay. Many people say that React is awesome on jsx. Yes, I am writing recently, but jsx is very flexible. The way of writing embedded functions allows you to do almost omnipotence. However, I would like to ask you the other way around. Regardless of the templates you have used in your life, no matter js, java, python, whose templates do not support if and for, someone jumped out to teach me that jsx is not a template, and the definition of a template is too simple A string that supports variable substitution like \${}, this is a template, and jsx fully meets this condition. Of course, the needs of the masses are always met, and there are a large number of if and for implementations available on npm.

Another point I want to talk about is redux or flux. This design, in order to make up for the lack of one-way transmission of data in React itself (you say it s a feature, I can t help it), I think one-way is actually a kind of reverse, because no matter what before ng1, now ng2, domestic vue and avalon that supports ie6 are all dual-binding support, but in the case of react, this is one-way binding. I saw redux at first sight. Isn t this just a state machine? Think about it again. I think back to my undergraduate courses on compilation principles and formal languages and automata. Yes, a state machine is not simple, especially when it comes to It is not an easy task to sort out the status of the system clearly, and it is very demanding on the team. Therefore, when I selected the project, I decisively refused redux to use the familiar event model.

By the way, there is a problem I encountered, a tab component, the requirements are very simple (1) to achieve the basic tab function, that is, click on the tab to highlight the label and switch the corresponding tab (2) the style and html of the label by the user Enter by yourself, there is no limit to what it is, just highlight the bg-color of the label. (3) The tab label and content do not necessarily have an adjacent or nested relationship on the dom. This is optional. This requirement should use jq or even the source should be handwritten. Then everyone try how much code is needed for reactive development? ?

Next, let's talk about hybrid development. This thing is obviously designed for enterprise development. Of course, I won't talk about the kind of business that goes bankrupt after a long time or gets the money to transfer to native. Enterprise development can be implemented. It does not require much cool interface and fluency. Intranet is not sensitive to network speed. No one in internal applications is free to look at your code or find your loopholes. This is a perfect avoidance of mixed development. Weakness. No way, the characteristics of js, no matter what the confusion is, it is naked and the same as not wearing underwear. This is definitely not comparable to lua, a scripting language that can change the parser in addition to traditional confusion. So, for the current WeChat mini-applications, in addition to the traditional H5 problems, your entrance, users, and the entire life are in the hands of others. Are you willing? Perhaps, this can clean up the chaos of the current app, leaving behind the features that users really need, that is, those "public welfare" applications of large companies and large enterprises, such as checking express delivery, registering, and checking laboratory inspections. These unmanned competitions and copying Things that are useless are perfect for trying out small apps.

Recently, rn has been released, and Ali s weex has been released. This is different from the framework of cordova (the project upgrade of cordova some time ago, it is really the same as the name, it is written as cordova and reads as pits and digs). Cordova has a different framework. There are a large number of native plug-ins that are enough for you to adapt to the original function. Fortunately, the ones with rn are on the ship of React. Some people solve the problems of the native layer. However, for the new native framework, you can make sure that you can do it yourself. What.

Front-end people like to make wheels. A few days ago, I found a framework for url param splicing. After installing and sending other applications, it actually relied on 2 url param, and the length was different. After a careful look, there are still a lot of dependencies like isEmail and isURL. Counting a project just started with more than 600 node modules (of course including dev dependencies), if you put it in java, this is incredible, because A set of apache utils provides many functions. Now that apache is mentioned, I want to talk about java. Many people say that the front-end has changed drastically, and the back-end is the same as stagnant. Then I want to ask, whether taobao or 12306 is the result of front-end optimization in the past few years. Can the back end solve the big concurrency problem as long as it fends for itself?

If it is a java project selection, spring must pass unanimously as the bottom layer, and the next may be mybatis and hibernate duel. This is almost the only choice based on the characteristics of the project. After these are set, there is nothing to argue about. But for the front-end selection, I estimate that react, vue, and ng can be played in one day. Therefore, the style of java, which has remained unchanged for ten years, has precipitated the essence of not knowing much. In addition to the tuning of virtual machines, there are also a large number of sports cars. This is not a wheel, including how many generations of lucene have evolved (now all use Elasticsearch), and a series of data mining frameworks such as hadoop and spark. I am embarrassed to talk about the rest of the workflow and data bus. But now that the front end has jumped out, they want to use js to sweep everything, I want to ask so many java, php, python, c++, erlang, golang engineers will sit and wait to die?

It s a good thing to remain unchanged and respond to ever-changing changes. js started in a hurry, and now it has evolved to ecma2015, but the bottom layer is still the ugly ecma3 (I don t reject God s request, if God gives me money, I will do IE8 compatibility). How many people are using java1.6 and python2.7? I believe that language and syntactic sugar are definitely not the first choice, because if you really like syntactic sugar, then you should support c#. The only explanation is that the people who engage in js are fine. Take your own time to revitalize your own life. Habits are a good thing. If it is stable and meets the requirements, the TV you watch has been square for many years, and the bicycle has two round wheels for many years. What is the js world like now? There is a very awesome bicycle. The cool running is fast, the only problem is that there is no grip, which needs to be realized by yourself. .

Just need and self-revolution are two different things, what really solves just need, one is jq, and the other is ng1, which I think is the large-scale push of mvvm. Unfortunately, both of these are despised by you, and then google hastily drove out the ng2 car , And found that I built a super awesome complier on the front end, which increased the burden on the system. It was not until the official release a few days ago that there was aot. Then it is react, which mixes html into js. On the other hand, when we look at architecture tools, glup and grunt are already history. Webpack emerged last year and some people will kill them this year. What packaging tool will be next year? Grunt is not wrong, his design is batch processing, compression, obfuscation, and integration can be done. Webpack is also a bundle which is more convenient for heating and debugging. Then what features of the new architecture tool can make users abandon the previous things and recreate the mass What about the wheels?