Halstead complexity measures

This is an old revision of this page, as edited by Dekart (talk | contribs) at 22:38, 7 February 2008 (see also). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Halstead complexity metric is a software metric indroduced by Maurice Howard Halstead in 1977. This metric is computed statically, without program execution.

Calculation

Let's assume the following:

  •   = the number of distinct operators
  •   = the number of distinct operands
  •   = the total number of operators
  •   = the total number of operands


From these numbers, five measures are derived:

  • Program length:  
  • Program vocabulary:  
  • Volume:  
  • Difficulty :  
  • Effort:  


  • Number of the used different operators (( ) and operand ( ), ), together the vocabulary size  .
  • Number of the altogether used operators ( ) and operand ( ), together the implementation length  .

From this then the sizes of Halstead length become ( ) and Healstead volume ( ) are calculated:

  •  
  •  

From the base quantities one can compute different characteristic numbers, e.g.:

  •  

Where D = difficulty of the program to write or understand, e.g. with one Code review (?).

From http://www.sei.cmu.edu/str/descriptions/halstead.html [1] and the German wikipedia entry.

See also