Halstead effort
Halstead effort is one of a number measurements developed by Maurice Halstead to determine the mental effort required to develop or maintain a program. The lower a program's Halstead effort, the simpler the program is to change.
Rational® Asset Analyzer calculates Halstead effort for COBOL and PL/I programs using the following formula:
E = D * V
D = Difficulty, calculated as
D = (n1 / 2) * (N2 / n2)
V = Volume, calculated as
V = N * (LOG2 n)
These formulas use the following terms:
- n
- Program vocabulary, calculated as
n = n1 + n2
- n1
- The number of distinct operators. Rational Asset Analyzer uses the number of distinct statement types, as known to the product, occurring in the program.
- n2
- The number of distinct operands. An operand can be either a variable or a literal. Rational Asset Analyzer uses the number of referenced distinct data elements and literals.
- N
- Program length, calculated as
N = N1 + N2
- N1
- The total number of operators. Rational Asset Analyzer uses the total number of statements in the program.
- N2
- The total number of operands. Rational Asset Analyzer uses the total number of references to data elements and literals.