Correct and image to the function, variable name, not only can increase the readability of the program, but also a programmer's programming style of a reflection. Better naming habits, can effectively improve the maintainability of the program. The following is a description of the standard naming method, interested in the small partners can take a look.
1. DIV+CSS Specification named Collection
When we develop the Css+p Web page (Xhtml), the more confused and tangled thing is the CSS naming, especially the novice do not know where to name, how to name is a good way.
Description of the naming rules:
1), all the names are preferably lowercase
2), the value of the attribute must be enclosed in double quotation marks (""), and must have values such as class= "PCSS5", id= "PCSS5"
2. JS naming code: Hungarian nomenclature or hump naming law
Naming specification is necessary, can enhance the readability of the code, can understand the meaning of the expression at a glance, the specification is in line with the rules, so that the code is conducive to post-maintenance, but also to a large extent to improve the development efficiency. A normal website has a lot of JS code, if in the process of writing, do not follow a certain rules, then write to the back of their own do not understand what they write, this is a very troublesome thing, so in peacetime practice, develop a good habit of writing code.
3. CSS naming and normalization of its writing
The naming of commonly used classes should be as common as possible in English words, to be easy to understand, and in the appropriate place to comment. For class/id named two, the combined writing mode is used, the first letter of the next word should be capitalized: such as "search box" should be named "Searchinput", "Search icon" named this "Searchicon", "Search button" named "Searchbtn" ...
4. Canonical Naming of CSS
CSS3 has been released, and many web front-end engineers have started experimenting with the technology. How do we evaluate the ability to write CSS? We may use the words "good", "General" and "bad" to describe the right and wrong judgments. What is the hardest thing about CSS? Is it compatible with all major browsers? is the code simple and efficient? Front-end engineers have said: CSS is not a difficult technology, the difficulty is how to standardize the naming. Projects are done by individuals, and engineers can name the CSS according to their own habits. In team work, the non-canonical naming side may cause conflicts that affect the progress of the entire project. The following Lingnan network teaches you how to standardize the naming of CSS.
5. Teach you how to write a standard CSS style
Wrote so long CSS, but most of the front-end er are not in accordance with good CSS writing code to write CSS, this will affect the code reading experience, here summarizes a CSS writing specification, CSS Writing order for everyone to reference
These are references to some foreign articles and my personal experience summed up, I would like to write CSS front-end users are worth learning.
6. Very detailed front-end JavaScript specification
Front-end third-party JavaScript package management tool Bower (Bower install jQuery), Bower can realize the dependency resolution, download, upgrade management of third-party library. We recommend establishing an enterprise-class bower.
Front-end build tool, can use grunt or gulp tools, can implement HTML, CSS, JS compression, verification, testing, file merging, watch and Liveload and other front-end tasks. Recommended Enterprise-Class Nodejs NPM.
Front-end development Ide:webstorm (IDEA), sublime as the best. The project team unifies the IDE. IDE Unified configuration is important.
Related Questions and answers:
1. JavaScript-why many projects like using RET and res when naming
2. Angular.js-directive naming rules?