未加星标

The best JavaScript framework is ... plain vanilla JavaScript

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二05 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

In the beginning, javascript was scary. Each browser had its own JavaScript APIs, and applications that worked on one browser would fail on another. Developers had to account for different behavior across the browsers, leading to convoluted code that was hard to write, debug and maintain. To help alleviate the pain, toolkits and frameworks such as GWT and Flex came along, offering powerful capabilities and cross-browser compatibility, and helping developers avoid JavaScript.

In recent years, though,JavaScript has become pretty powerful in its own right, and browser compatibility issues have been somewhat mitigated through increased standardization across browsers and html5 templates. But the perception that JavaScript is scary and even unreliable has persisted. This led to the rise of JavaScript frameworks.

These frameworks, such as Angular and React, are effective tools for rapid development of simple applicationsand are great training wheels for JavaScript beginners. But for long term projects that grow and evolve over time, they are not always the best choice.

TechBeacon App Security Buyer's Guide and Sample RFP

Download Now

The problem with frameworks

Frameworks are created to make life simpler and save time for developers, by automatically managing the state of the user interface, and taking care of data binding.

In reality, though, these benefits turn out to be huge disadvantages. When building interactive real-time applications, you want to have the most control possible over the actions performed inside the browser. But the framework actually takes away that control, and performs redundant operations such as managing an event loop (e.g., Angular’s digest loop), or building a virtual Document Object Model (DOM), which slows down the browser and negatively affects the user experience.

For example, when a user is interacting with a live chart that’s being updated every second, you can’t afford those redundant operations. Every action taken by the browser must be precise and deliberate, so the user doesn’t notice that the chart is being updated when they’re playing with it.

This is not only an issue of real-time applications; it’s also a concern when performing complex animations, or rich interactions that require fast rendering (such as zooming in and out). Any redundant actions will cause performance issues.

By the time you notice these issues, however, it’s too late to do anything about them. Because of the fact you’re already committed to the framework, you can only go so far with your optimizations. Even minor optimizations require a significant investment of time and effort, because you’re restricted by the framework’s structure, which can’t be modified, and is difficult to understand.

Frameworks are highly effective if you want to quickly construct a prototype. But if the customer or your designer has user experience requirements that go beyond the basic functionality provided by the framework, it starts to get more complicated. Each framework tends to enforce its own rules about what you can and can’t do with it, and this can be very limiting if you need to build a highly customized and unique user experience.

For example, you might need to add a new control that the framework doesn’t support. You’ll spend a lot of time hunting around in vain for third party code that does exactly what you need, and you’ll probably end up having to develop it yourself.

The solution: Do it yourself

JavaScript on its own has none of these issues. It’s amazingly flexibleand offers the developer total freedom to experiment and explore different approaches to a problem.

In my experience, the best choice for user-interface flexibility and long-term maintainability is plain and simple JavaScript. Add some utility libraries such as D3.js for mathematical calculations or Socket.io for real-time communications, and you’ll have an easily maintainable code base that does exactly what you need.

As an example, a friend and I recently built the website pancake-finance.com , an interactive stock-tracking dashboard built with simple JavaScript. We had a very clear vision in mind when we built it, and we couldn’t find a framework that answered all of our requirements without compromise. It took us just a few months to put it together using plain and simple JavaScript, and the result is a smooth and responsive user interface that we have complete control over.

JavaScript has made a lot of progress

JavaScript and CSS are continuously evolving. They’ve become very powerful, endlessly flexible, and increasingly easier to use. If you’re about to start a long-term project, consider using JavaScript instead of committing to a framework.

Developers new to JavaScript might find it somewhat confusing and maybe even frustrating, but as you develop a deeper understanding of the language , you’ll find that you’re able to build rich, smooth, and highly customizable web apps without having to compromise on functionality.

The experience and skills that you gain by using JavaScript will always be relevant, no matter which framework is hottest at the moment. Basic JavaScript skills are immediately applicable.

Are you using a framework? Share your thoughts and concerns about going with plain and simple JavaScript.

TechBeacon App Security Buyer's Guide and Sample RFP

Download Now

Image source: Flickr

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: JavaScriptJavaHTMLReactCSSHTML5mathematica
分页:12
转载请注明
本文标题:The best JavaScript framework is ... plain vanilla JavaScript
本站链接:http://www.codesec.net/view/479768.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(53)