Maintainable JavaScript (writing maintainable JavaScript) part I Style guidelines

Source: Internet
Author: User

"Programs is meant to being read by humans and only incidentally (incidentally; incidental;) for computers to execute."-donald Knuth

When a team is brought together (put together) for the first time, everyone brings with them their own ideas about how Cod e should be written. After all, each team member comes from a different background. Some come from one-man shops where they could do whatever they wanted; Others may has been on different teams the had particular ways of doing things that they liked (or hated). Everyone has a opinion about How code should is written, and it usually falls in line with (fall on line with consent) how That individual would personally write it. Establishing style guidelines should always come as early in the process as possible.

The terms "style guidelines" and "code conventions" are often used interchangeably. Style guidelines is a type of code convention aimed at the layout of code within a file. Code conventions can also include programming practices, file and directory layout, and commenting. This was actually a collection and discussion of code conventions for JavaScript.

Why Style guidelines?

Figuring out style guidelines are a process that typically takes longer than it should. Everyone has a opinion and, if you ' re going to being spending eight hours a day writing code, all programmers want to do So-in a-comfortable to them. It takes some compromise within the team and a strong leader to move the conversation forward. Once established, style guidelines allow the team to work at a much higher level, because all code looks the same.

Have all code look the same are incredibly important on a team, because it allows:

any developer to work on any file regardless of (regardless of) who wrote it. There ' s no need to spend time reformatting or deciphering the logic of the file, because it looks the same as everything E Lse. If you've ever opened a file and immediately fixed all the indentation before starting your work that you can understand the T IME savings conSistency provides when working on a large project.

errors become more obvious. If all code looks the same, and you come across some code this doesn ' t, you ' ve likely found a problem.

It's no wonder that large companies around the world has published style guidelines either internally or publicly.

Style guidelines is a personal thing and must is developed within a team to be effective. This sections of the book lists recommended focus areas for the development of your JavaScript code conventions. In some cases, it's impossible to the tell me one guideline is better than another, because some was just a matter of PR Eference. Rather than trying to force my preferences upon you, this chapter highlights important aspects that should being covered in Y Our style guidelines. My Personal Code Style guidelines for JavaScript is included in appendix A.

Maintainable JavaScript (writing maintainable JavaScript) part I Style guidelines

Related Article

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.