- JavaScript:Moving to ES2015
- Ved Antani Simon Timms Narayan Prusty
- 240字
- 2021-07-09 19:07:47
Best practices and troubleshooting
In an ideal world everybody would get to work on greenfield projects where they can put in standards right from the get go. However that isn't the case. Frequently you may find yourself in a situation where you have a bunch of non-modular JavaScript code as part of a legacy system.
In these situations it may be advantageous to simply ignore the non-modular code until there is an actual need to upgrade it. Despite the popularity of JavaScript, much of the tooling for JavaScript is still immature making it difficult to rely on a compiler to find errors introduced by JavaScript refactoring. Automatic refactoring tools are also complicated by the dynamic nature of JavaScript. However, for new code, proper use of modular JavaScript can be very helpful to avoid namespace conflicts and improve testability.
How to arrange JavaScript is an interesting question. From a web perspective I have taken the approach of arranging my JavaScript in line with the web pages. So each page has an associated JavaScript file, which is responsible for the functionality of that page. In addition, components which are common between pages, say a grid control, are placed into a separate file. At compile time all the files are combined into a single JavaScript file. This helps strike a balance between having a small code file with which to work and reducing the number of requests to the server from the browser.
- Embedded Linux Projects Using Yocto Project Cookbook
- Qt 5 and OpenCV 4 Computer Vision Projects
- 控糖控脂健康餐
- Apex Design Patterns
- 零基礎(chǔ)學(xué)Python數(shù)據(jù)分析(升級版)
- Frank Kane's Taming Big Data with Apache Spark and Python
- Learning Docker Networking
- Scala編程實(shí)戰(zhàn)
- 算法設(shè)計(jì)與分析:基于C++編程語言的描述
- Learning Kotlin by building Android Applications
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite
- Java編程指南:語法基礎(chǔ)、面向?qū)ο蟆⒑瘮?shù)式編程與項(xiàng)目實(shí)戰(zhàn)
- Three.js Essentials
- Hands-On GUI Application Development in Go
- 匯編語言程序設(shè)計(jì)教程