This is a concern of many web page makers and developers. There is no magic. You can make sure that your style sheet is reduced to, but the CSS coding and organization skills are reasonable, it can indeed help you write more clearly and efficiently Code , Naturally, reducing the size of the style sheet can also reduce the download time.
I. Layout:
1. Add spaces between keywords and operators.
2. Relatively independentProgramAdd blank lines between blocks
3. Long statements and expressions should be divided into multiple books.
4. The new lines should be indented to make the layout neat and the statement readable.
5. Long expressions should divide the new line at the lower-priority operator, and the operator should be placed at the beginning of the new line.
6. If a long expression or statement exists in statements such as loop and judgment, an appropriate division is required.
7. If the parameters in a function or process are long, appropriate division is required.
8. You are not allowed to write multiple phrase sentences in one row, that is, only one statement can be written in one row.
9. The code in the statements such as the start of a function or process, the definition of the structure, and the cycle and judgment should adopt the indent style.
10. c/C ++ uses braces '{' and '}' to define a block. When compiling a block, '{' and '}' should each have an exclusive row and be in the same column, at the same time, it is left aligned with the statements that reference them. At the beginning of the function body, the definition of the class, the definition of the structure, the definition of enumeration, and the programs in the IF, for, do, while, switch, and case statements must adopt the above indent method.
Ii. Notes
1. Annotations should be simple and clear.
2. Write and annotate the code, modify the code, and modify the corresponding comments to ensure the consistency between the comments and the code.
3. Make comments where necessary. The comments must be moderate. The content of the comment must be clear, clear, and accurate, so as to prevent the ambiguity of the comment. Keep comments adjacent to the code described by them, that is, the proximity principle of comments.
4. Comments to the code should be placed at the top of the adjacent location, not below.
5. comment on the data structure should be placed in the adjacent position above it, and cannot be placed below; comment on each field in the structure should be placed on the right side of this field; Comment on different fields in the same structure should be aligned.
6. Comments of variables and constants should be placed on the adjacent positions or the right side above them.
7. global variables should be annotated in detail, including descriptions of their functions, value ranges, functions or processes to access them, and precautions for access.
8. Make necessary comments in the header of each source file, including: file name, version number, author, generation date, module function description (such as function, mainAlgorithm, The relationship between the internal parts, the relationship between the file and other files, etc.), the list of main functions or processes, and the historical modification records of this file.
9. note the necessary information before each function or process, including the function or process name, function description, input, output, and return value description, call relationship, and called relationship description.
Iii. Naming
1. Short words can be abbreviated by removing the "vowel;
2. The priority of the first few characters of a long word can be obtained, and the operation sequence of the expression is defined with parentheses to avoid using the default priority.
3. Using Hungarian notation