Halstead’s Complexity Measures

In 1977, Mr. Maurice Howard Halstead introduced metrics to measure software complexity. Halstead’s metrics depends upon the actual implementation of program and its measures, which are computed directly from the operators and operands from source code, in static manner. It allows to evaluate testing time, vocabulary, size, difficulty, errors, and efforts for C/C++/Java source code.

According to Halstead, “A computer program is an implementation of an algorithm considered to be a collection of tokens which can be classified as either operators or operands”. Halstead metrics think a program as sequence of operators and their associated operands.

He defines various indicators to check complexity of module.

n1Number of unique operators
n2Number of unique operands
N1Number of total occurrence of operators
N2Number of total occurrence of operands

When we select source file to view its complexity details in Metric Viewer, the following result is seen in Metric Report:

MetricMeaningMathematical Representation
nVocabularyn1 + n2
NSizeN1 + N2
VVolumeLength * Log2 Vocabulary
DDifficulty(n1/2) * (N1/n2)
EEffortsDifficulty * Volume
BErrorsVolume / 3000
TTesting timeTime = Efforts / S, where S=18 seconds.


Related Posts

© 2023 Software Engineering - Theme by WPEnjoy · Powered by WordPress