Halstead complexity measures: Difference between revisions

Content deleted Content added
Dfg13 (talk | contribs)
expand introduction
Dfg13 (talk | contribs)
improve formatting of equations; use eta instead of n as in original book
Line 9:
== Calculation ==
First we need to compute the following numbers, given the program:
* <math>n1\eta_1</math> = the number of distinct operators
* <math>n2\eta_2</math> = the number of distinct operands
* <math>N1N_1</math> = the total number of operators
* <math>N2N_2</math> = the total number of operands
 
From these numbers, five measures can be calculated:
* Program length: <math>N = N1N_1 + N2 N_2 \,</math>
* Program vocabulary: <math>n\eta = n1\eta_1 + n2 \,eta_2 </math>
* Volume: <math>V = N \times \log_2 n\eta \,</math>
* Difficulty : <math>D = { n_1\eta_1 \over 2 } \times { N_2 \over n_2\eta_2 } \,</math>
* Effort: <math>E = D *\times V \,</math>
 
The difficulty measure is related to the difficulty of the program to write or understand, e.g. when doing [[code review]].