Halstead complexity measures

This is an old revision of this page, as edited by Dfg13 (talk | contribs) at 07:10, 23 May 2011 (add reference). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Halstead complexity measures are software metrics introduced by Maurice Howard Halstead in 1977.[1] These metrics are computed statically, without program execution.

Calculation

First we need to compute the following numbers, given the program:

  •   = 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 can be calculated:

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

The difficulty measure is related to the difficulty of the program to write or understand, e.g. when doing code review.

References

  1. ^ Halstead, Maurice H. (1977). Elements of Software Science. Amsterdam: Elsevier North-Holland, Inc. ISBN 0-444-00205-7.

See also

  • The Halstead metrics - Extensive discussion on the calculation and use of Halstead Metrics in an object-oriented environment (with specific reference to Java).
  • Calculation of Halstead metrics - Measurement of Halstead Metrics.
  • [1] - Maintainability Index in Microsoft's Visual Studio and its relation to the Halstead complexity measure