SP: Structured Programming
The costs of producing and maintaining a computer program are largely determined by its complexity.
In writing computer programs a programmer typically uses structured programming techniques to break complex problems down into simpler problems that are easier to understand and solve. This “divide and conquer” process can be repeated until each component is small enough and simple enough to understand, build and maintain.
There are various indications that the divide and conquer process has not been completed:
- SP-1: Routine Too Long
Routines longer than 150 lines (excluding comments and blank lines) have been shown to be less stable, more subject to change, and more expensive to fix than shorter routines.
- SP-2: Nesting Too Deep
Studies have shown that few people can understand nesting of conditional statements to more than 3 levels.
- SP-3: Routine Too Complex
Control-flow complexity has been correlated with low reliabilty and frequent errors.
- SP-4: Module Not Cohesive
Routines which are cohesive are typically easier to modify, easier to fix and contain less errors than routines with diverse tasks.
- SP-5: Poor Choice of Name
A name used in a program is too short, too long, too cryptic, too similar to another name or inconsistent with other names.