Metrics • Average LOC per Function Metric. An accepted industry standard of 200 LOC per function is desired as the average LOC per function • Maximum LOC per Function Metric. • Minimum LOC per Function Metric. A minimum LOC per function of 2 or less can indicate functions that may have been prototype but not yet complete..
Metrics • Cyclomatic Complexity. It is a quantitative measure of the number of linearly independent paths • Paths occurs when a "while", "for", "if", "case" and "goto" keywords appear within the function. • if the source code contained no control flow statements (conditionals or decision points), the complexity would be 1 • If the code had one single-condition IF statement, there would be 2 paths through the code: one where the IF statement evaluates to TRUE and another one where it evaluates to FALSE • Two nested single-condition IFs, or one IF with two conditions, would produce a complexity of 3.
Complexity Complexity Number Meaning 1-10 Structured and well written code High Testability Cost and Effort is less 10-20 Complex Code Medium Testability Cost and effort is Medium 20-40 Very complex Code Low Testability Cost and Effort are high >40 Not at all testable Very high Cost and Effort
asu.edu Sum m er 2017 Disclaim er. These slides can only be used as study m aterial for the class C SE360 at ASU. They cannot be distributed or used for another purpose.