
Measuring Internal Product Attributes ◾ 345
EXAMPLE 8.7
Halstead’s software science attempted to capture attributes of a program that
paralleled physical and psychological measurements in other disciplines. He
began by dening a program P as a collection of tokens, classied as either
operators or operands. The basic metrics for these tokens are the following:
μ
1
= Number of unique operators
μ
2
= Number of unique operands
N
1
= Total occurrences of operators
N
2
= Total occurrences of operands
For example, the FORTRAN statement
A(I) = A(J)
has one operator (=) and two operands (A(I) and A(J)).
The length of P is dened to be N = N
1
+ N
2
, while the ...