Table 6.1 illustrates a simple FORTRAN routine and the associated values of N1,N2,n1 and n2
Halstead defines several quantities using these numbers. For example , program length N is defined as N1+N2; (N1+N2=50 in Table 6.1)
Halstead's estimator of program length is :
-------------------------------------------------------
2) Halstead's Software Metrics Halstead [12] proposed a set of software metrics for measuring the algorithmic complexity by counting operators and operands from software codes. Let n 1 = number of distinct operators, n 2 = number of distinct operands, N 1 = total number of operator occurrences, and N 2 = total number of operand occurrences. Based on the above notations, the definition of Halstead’s measures can be summarized as displayed in TABLE II
=========================================================
TABLE 3. D EFINITIONS OF D ERIVED M EASURES OF H ALSTEAD ' S S OFTWARE M ETRICS [1], [12] Measure Symbo l Formula Program length N N = N 1 + N 2 Program vocabulary n n = n 1 + n 2 Volume V V = N*(log 2 n) Estimated abstraction level L L= (2 n 2 ) / ( n 1 *N 2 ) Difficulty D D= 1 / L Effort E E = V * D Time T T = E / 18 Remaining bugs B B = E 2/3 / 3000 Using Halstead's metrics to measure the operators and operands inside each BCS along with the cognitive weight of that BCS would help eliminate the sense that the measure considers all BCS's of the same kind as having the same cognitive complexity no matter what they contain inside