7 Steps to better JavaScript
Original: http://www.creativebloq.com/netmag/7-steps-better-javascript-51411781
Seven steps to get you to write a better JavaScript code
As browsers improve performance, new HTML5 APIs are being applied, and JavaScript continues to grow in web usage.
However, a bad line of code can affect the entire site, creating a bad user experience and causing a loss of potential customers.
The developer must use the tools and techniques he can use to improve the quality of the code to ensure that the code can be executed reliably and accurately every time.
It's a question I've been focusing on, and I've been trying for years to find a solution to ensure that only high-quality code will be released during development.
With these seven steps to constantly modify the quality of your JavaScript project, in this step, very few errors will appear, but will easily be repaired, so that users can browse smoothly.
01 Code
Use a strict usage declaration in your function to invoke Ecmsscript 5 's strict mode, while using the module design pattern, which separates the code module from the sandbox in an automated function closure, thus reducing the use of global variables, Keep the module code clear and concise by passing any external correlation. In addition, you must make your functions easier by using the published and easily tested third-party libraries and frameworks, separating all business logic code from your DOM manipulation and other view-layer code.
Large multi-person projects must follow a set of coding specifications, such as Google's JavaScript Style Guide, and the need for strong code handling rules, including the strict dependency management of asynchronous module definitions that are invoked through the Requirejs library. Use Bower or jam these package management to specify your dependent file versions, using structured design patterns, such as: Observer patterns, to help implement loose communication between your different code modules.
Using a code like GIT or subversion to access the repository system is a good way to go through, for example, GitHub or beanstalk, these services can be used to restore the capacity of the previous code version to the cloud service, and for larger projects, Before the project can be merged, it is possible to create multiple branches according to various needs.
02 Files
[label][translation][javascript-translation] Seven steps to write a better JavaScript code