今日推薦英文原文：《Top 10 Java Script Frameworks》作者：Lokesh Gupta
推薦理由：介紹了一些好的 JS 框架，興許說到這個大家可能都會想到 Angular Vue React 這三個，實際上除了它們之外，也有不少好的框架
Top 10 Java Script Frameworks
Angular.js is a popular open-source front-end development framework which is mainly used for developing dynamic single-page web applications (SPA).
AngularJS transfers all the contents from the server to the browser along with loading all the web pages simultaneously. Once the contents are loaded, clicking on any link on the page does not reload the entire page content; instead, it simply updates the sections within the page.
React is a library used for developing UI applications. It was released in 2013 and has been a fastest growing JS framework in today』s world.
React.js is most preferred when a high performing enterprise application needs to be delivered to its users. It is powered by user interfaces like that of Instagram and Facebook.
There has been a constant war between choosing Angular and React. React is more flexible when compared to Angular since developers will have to work with independent libraries with comparatively better response time. React is excellent when it comes to handling small and stateless functions that receive an input and return elements as their output. It focuses on JS ES6, and Flow can be used to enable type-checking in React.
Every project in React has a different architecture along with limited guidance and hence, it is easy to go wrong. React is mainly used for the V (view) in the MVC model since the UI can be updated without having to reach out to the server and fetch a new view.
Ember is also an open-source framework that lets developers create a single page and large web applications. Ember has been a highly opinionated framework which was built to be very flexible.
While Angular and React are flexible and less opinionated, Ember makes a lot of assumptions about the application and makes a developer confirm to its expectations.
A complete development stack can be formed by using Ember and other important tools. Ember has a widget based approach called as Ember components. Handlebars layout and Ember』s backend architecture allows writing developers own application-specific HTML tag.
Handlebars integrated templates update automatically when the underlying data changes along with significantly lesser coding. Websites like LinkedIn, Vine and Live make use of Ember. It is also used to build desktop and mobile applications.
One of the most notable uses of Ember is in Apple Music, the desktop application. Ember has a powerful routing system when compared to React or Angular.
In case of updates, Ember is ahead of many frameworks, with new features being frequently added.
Vue.js was released in 2014 and is the fastest growing framework adopted by developers. It is a lightweight progressive JS framework which gets a lot of its concepts from ReactJS and AngularJS.
It has a template style similar to Angular and has component based props just like ReactJS. Vue provides an easy and fast fix for applications, UI, and an interactive web interface development. It can power advanced single page web applications.
The most significant advantage of choosing Vue over React is that in Vue, the component』s dependencies are tracked automatically during its rendering. Thus, the system knows which component needs to be re-rendered when a state changes.
This prevents extra work needed for optimization and lets the developer focus more on building the app.
It offers MVP network, which abstracts the data into models, Document Object Model (DOM) into views and binds these two using events.
Unlike other frameworks, Backbone puts the developer in charge of choosing the right tool that works best for a given project. A templating engine of its own does not exist in Backbone.
Companies like Sony Entertainment Network, Airbnb, and SoundCloud use Backbone.js for their projects. Companies and developers use Backbone due to its ability to use any code as its controller while keeping the controller optional.
It is tiny (less than 8KB gzip), fast, provides routing and XHR utilities. It supports all the browsers like IE9 without the requirement of any polyfills.
Mithril is currently being used by companies like Nike and Fitbit and other open source platforms like Lichess. Mithril makes use of sophisticated and optimized virtual DOM algorithm to minimize the amount of DOM updates.
The reason why Mithril supports a rendering model which recreates the whole of virtual DOM tree is to provide a declarative API which makes it easier to manage UI complexity. Mithril is known to be pragmatic since it is straightforward to learn components, routing and XHR in less than 15 minutes to start building applications.
Mithril has in-built modules for XHR and routing while React needs third parties for the same along with a lot of memory usage. Also, the library load time and update performance of Mithril is fast when compared to React or Angular or even Vue! Vue.js』 size, also being small and compact, is still larger than Mithril. Unlike Vue, Mithril has lesser concepts and organizes apps regarding data layers and components.
Polymer is used by a lot of Google services and websites. It is being used by YouTube, Google Play Music and Netflix, to name a few. The polymer has started to gain recognition in the market with a lot of attention given to its structured design process. Since components are the biggest strengths of Polymer, it has better support for web components and has better offline modules when compared to React.
The power of React and Polymer can be used to have a more component-oriented future for web development. Polymer 『s components and Angular』s directives show some kind of similarity but have a different approach to create custom HTML elements.
Since Angular has all of its components bundled into one large pack, it becomes difficult to remove or change components in this architecture. Aurelia, on the other hand, consists of a vast collection of libraries that work together using well-defined interfaces so that it turns out to be completely modular.