[Label] Translation [Javascript-translation] Seven steps to get you to write a better JavaScript code

Source: Internet
Author: User

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

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.