How do you QC your program's code quality?
1. Comments
1.1 Program comment
1.1.1 Is there one at the start of the program?
1.1.2 Does it indicate what the program does?
1.2 Block comment (comment on its own line)
1.2.1 15 there one at the start of each group of statements that completes a logical task?
1.3 User-defined function comment
1.3.1 Is there one at the start of each user-defined function except main?
1.3.2 Does it describes what the function does using one or two verbs?
1.3.3 Is it indented one level from the function definition line?
1.3.4 Does it includes a phrase for each parameter on its own line that describes
the role of the parameter, including its type?
1.1 Program comment
1.1.1 Is there one at the start of the program?
1.1.2 Does it indicate what the program does?
1.2 Block comment (comment on its own line)
1.2.1 15 there one at the start of each group of statements that completes a logical task?
1.3 User-defined function comment
1.3.1 Is there one at the start of each user-defined function except main?
1.3.2 Does it describes what the function does using one or two verbs?
1.3.3 Is it indented one level from the function definition line?
1.3.4 Does it includes a phrase for each parameter on its own line that describes
the role of the parameter, including its type?
1.4 User-Defined Class Comment
1.4.1 Does one appear at the start of the class?
1.4.2 Does it indicate what the class is used for?
1.4.1 Does one appear at the start of the class?
1.4.2 Does it indicate what the class is used for?
2. Identifiers/Names
2.1 Are they descriptive of their use?
2.2 Do they use lower_case_with_underscores?
2.1 Are they descriptive of their use?
2.2 Do they use lower_case_with_underscores?
2.3 Does each user-defined class name use: CapitalizedWords?
3. Code Reflects Design
3.1 Does each rectangle in the algorithm translate to a sequence of simple statements in the code?
3.2 Is there a one-to-one correspondence between control structure icons in the algorithm and
corresponding control structures in the code?
3.1 Does each rectangle in the algorithm translate to a sequence of simple statements in the code?
3.2 Is there a one-to-one correspondence between control structure icons in the algorithm and
corresponding control structures in the code?
Remember : Good programmers write comments. Great programmers don't need to!
4. Literals
4.1 Does each literal (other than 0, 1, 2, -1, 0.0 and ") with common intent appear exactly once?
4.1 Does each literal (other than 0, 1, 2, -1, 0.0 and ") with common intent appear exactly once?
5.Repetition
5.1 Have all adjacent duplicate line groups been replaced by repetition control structures?
5.1 Have all adjacent duplicate line groups been replaced by repetition control structures?
6. Name-spaces...
7. User—defined Functions
7.1 Does each perform a single logical task that can be described by a sentence with
1 or 2 verbs?
7.2 Does each have 5 or fewer arguments?
7.3 Does each contain 12 or fewer statements?
7.4 Have all non-adjacent duplicate line groups been replaced by calls to user-defined
functions?
7.1 Does each perform a single logical task that can be described by a sentence with
1 or 2 verbs?
7.2 Does each have 5 or fewer arguments?
7.3 Does each contain 12 or fewer statements?
7.4 Have all non-adjacent duplicate line groups been replaced by calls to user-defined
functions?
8. User-Defined Classes
8.1 Does a user-defined class represent each group of objects that is used in two or more tasks and forms a single conceptual object?
8.1 Does a user-defined class represent each group of objects that is used in two or more tasks and forms a single conceptual object?
8.2 Is each non-method attribute defined in a user-defined class marked as private
by using a leading underscore?
8.3 Is each private attribute defined in a user-defined class only used inside
the class definition?
8.4 Does each method defined in a user-defined class satisfy the software quality tests for
user-defined functions?
by using a leading underscore?
8.3 Is each private attribute defined in a user-defined class only used inside
the class definition?
8.4 Does each method defined in a user-defined class satisfy the software quality tests for
user-defined functions?
No comments:
Post a Comment