Code standards && "mathematical beauty" Book

1, with the identifier to sense, for example, the function name reflects the function of the function to achieve, such as DayCalculate. Loop variable affected by this rule.

2, with corresponding code to be annotated to comment in detail the key code for the function. Including program title, purpose and function description, document author, last modification date.

3 in a row just write a statement and rational use of space to ensure good visual effect.

4, each nested function block, a TAB indentation. Braces must be on the next line conditional statement into a single line, to facilitate matching pair.

5. code to be clear enough, not the pursuit of efficiency and the use of the code more difficult to understand.

6, the line width in principle, over 80, the 22-inch screen has a market share finished, how can not be justified.

7, function parameters, logic conditions, initialization list: either all the parameters and function names on the same line, or all the parameters side by side branches;

8, in addition to the function definition left brace may be placed outside of the line, including the function / class / junction diode / enumeration declaration, a left brace at the line end of the various statements, all right brace separate line;

9, / -> Ji intervening spaces before and after the operator, * / & not leave both before and after, a can, according to individual preferences left right;

"Mathematical beauty" Book

1, read "mathematical beauty" This book, the first impression is very shocked, the original can be used not only mathematics exam, our program design and code thinking also has a very important role, how to optimize our programming and structure, optimize our algorithms can achieve a clean code through a simple mathematical approach. Make our code more efficient. I hope I can apply what they learn from this book, use some simple math, efficient implementation of the code, which took the road to the god of the code it. In addition to learning algorithm designed to build a strong mathematical foundation, the algorithm you want to learn to make cattle fork algorithm, it is much to learn mathematics, multi-trick of imitating someone else's!

Guess you like

Origin www.cnblogs.com/os123/p/11488469.html