Halstead metric

from Wikipedia, the free encyclopedia

The Halstead Metric is a software metric introduced by Maurice Howard Halstead in 1977 . It belongs to the static, analyzing methods of measuring the complexity of software .

In this case, the system component is not actively executed (as in the dynamic process), but information about the test item is collected using analytical means.

calculation

The Halstead metric uses the assumption that executable program parts are made up of operators and operands. Defining what the operators and operands are to be considered is one of the tasks before using a Halstead metric. Typically, e.g. B. Consider variables and constants as operands; Keywords , logical and comparison operators, etc. as operators.

The following basic dimensions are then formed for each program:

  • Number of different operators ( ) and operands ( ) used, together the vocabulary size .
  • Total number of operators ( ) and operands ( ) used, together the implementation length .

The sizes Halstead length ( ) and Halstead volume ( ) are then calculated from this:

Various key figures can be calculated from the basic parameters:

  • Difficulty writing or understanding a program, e.g. B. in a code review :
  • Effort:
  • Implementation time: seconds

The Halstead metric is easy to determine and calculate, can be automated and can be used for all programming languages. The key figures usually agree very well with the values ​​actually measured. The disadvantage is that it only affects individual functions and only measures lexical / textual complexity.

See also

literature

Web links

Individual evidence

  1. Programming Effort