No more JS frames needed.

Source: Internet
Author: User

Now, the JavaScript framework has become an integral part of Web project development. That's because for a long time there was a big difference between browsers, and people had to write frameworks to block that. The problem is that browsers are difficult to agree on even basic issues, so that the framework also designs its own models for how the browser works, such as how to propagate events, how to interact with the DOM, and so on. So there are many frameworks, common jquery, Dojo, MochiKit, Ext JS, AngularJS, Backbone, Ember, react and so on. In this case, Google engineer Joe Gregorio wrote in his blog:

I think it's time to rethink the JS framework model. There is no need to invent another way of doing things, just use Html+css+js.

Joe believes that over the past decade, browsers have become better, their support for standards has improved, each version is more powerful than the previous version, and also supports new standards such as HTML Imports, Object.observe, Promises, HTML Templates. And people are still writing the JS framework, probably out of inertia and habits.

Before further elaboration of the idea, he made a simple distinction between the three concepts related to web frameworks. Gist is a simple code, a library is a collection of larger code, and the framework is not just a simple collection of libraries, it also has its own event, Dom interaction model. Next, he explains why the JS framework is not needed:

    • The framework is an abstraction of the Web platform, but due to the existence of "abstract vulnerabilities" (abstraction leak), developers sometimes have to resort to Html+css+js, and sometimes they need to delve into the framework to find out where the problem lies. As a result, developers need to spend a lot of time learning and researching frameworks in addition to learning Html+css+js.
    • Another selling point of the framework is the ability to take advantage of the widgets library, in fact, the framework is not required, and each widget should be independent. The syntax highlighting code Editor Codemirror is a good example. It is built with JavaScript and can be used anywhere without the need for a framework.
    • The data binding attributes provided by the framework are not necessary, and should appear as libraries, not frameworks, even if needed.
    • The framework will eventually evolve into a silo, and the widgets created for the A framework cannot be used for frame B, which can cause waste.

Joe proposes that the basic idea behind the JS frame era is that developers should build widgets using Html+css+js's capabilities. These widgets are independent of each other and can be used in combination. Web Components provide the possibility for all of this. Technologies such as HTML Imports, HTML Templates, Custom elements, and shadow dom allow developers to create reusable elements and features. To learn more, see the following articles and libraries:

    • HTML Imports
    • Polymer
    • X-tag
    • Bosonic

The first thing to do with Web Components is to have polyfills for related features. In particular, he stressed that Polyfills is not a framework, they do not introduce their own web development model, but make the HTML 5 model available. At the same time, they make up for a certain degree of deviation between browser implementations and existing standards. There are often short, single-function polyfills on the MDN.

It's good to build a large HTML 5 Polyfill library, but it's better to have a set of tools that can generate a subset of the full HTML 5 Polyfill library based on your project needs. This allows developers to mix and match Web components and libraries from different sources, such as X-tag <x-foo> and polymer <core-bar>. Interested readers can view brick's github page and x-tag download page on how to get these custom elements. Joe points out that this is not to say that creating a custom element requires creating a custom packager, which is not a scalable idea, but a need to change the open source approach, a widget that is not a project, and a more lightweight, gist-like way of sharing might be more appropriate. In this regard, the project asset graph may be a good start. So, he thinks, now requires three things:

    1. The customary practices and guidelines for building reusable components;
    2. You can follow these practices to compile HTML, CSS and JS tools;
    3. Extensible HTML 5 Polyfill that can be cropped as needed.

In the future, according to Joe, developers no longer need to learn the latest frameworks, but simply introduce custom elements or libraries that meet specific needs to build their apps.

No more JS frames needed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.