Code that needs refactoring:
1 repetition
2 lengthy subroutines
3 A class with poor cohesion
4 loop too long or nested too deep
5 Long parameter list (7 parameters left and right)
Swict Case Optimization:
1 polymorphic
2 Table Driver
Function Name:
1 function command to describe its return value
2 procedure naming to use a verb phrase
Function parameters:
1 Incoming parameters cannot be modified
2 parameter ordering: output-Modify-output
Boolean variable name:
Use positive variables: Done, error, found, success, OK
Comments:
1 information that the code cannot represent (copyright, confidentiality requirement, version number, etc.)
2 Purpose Notes
3 Overview Comments
To persist in setting the hole cards:
"If this method doesn't solve the problem within 30 minutes,
I'm going to spend 10 minutes thinking about the other ways, and then using one to try the most feasible way. "
Quotes:
Dry:do not Repeat yourself
Kiss:keep it simple and Stupid
Talk is cheap, show me the Code
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Code Daquan Supplements