Halstead’s Software Science:
Statement:
A computer program is an implementation of an algorithm considered to be a collection of tokens which can be classified as either operators or operand.
- All software science metrics can be defined in terms of these basic symbols. These symbols are called as a token.
- The basic measures are
- n1 = count of unique operators.
- n2 = count of unique operands.
- N1 = count of total occurrences of operators.
- N2 = count of total occurrence of operands.
- Size of the program can be expressed as N = N1 + N2.
- Program Volume (V)
The unit of measurement of volume is the standard unit for size "bits." It is the actual size of a program if a uniform binary encoding for the vocabulary is used. V=N*log2n
- Program Level (L)
The value of L ranges between zero and one, with L=1 representing a program written at the highest possible level (i.e., with minimum size).
L=V*/V
- Program Difficulty
The difficulty level or error-proneness (D) of the program is proportional to the number of the unique operator in the program.D= (n1/2) * (N2/n2)
- Programming Effort (E)
The unit of measurement of E is elementary mental discriminations.
E=V/L=D*V
- Estimated Program Length
According to Halstead, The first Hypothesis of software science is that the length of a well-structured program is a function only of the number of unique operators and operands. N=N1+N2.And estimated program length is denoted by N^
N^ = n1log2n1 + n2log2n2
- Potential Minimum Volume
The potential minimum volume V* is defined as the volume of the most short program in which a problem can be coded.
V* = (2 + n2*) * log2 (2 + n2*)
Here, n2* is the count of unique input and output parameters
- Size of Vocabulary (n)
The size of the vocabulary of a program, which consists of the number of unique tokens used to build a program, is defined as: n=n1+n2
Where n =vocabulary of a program
n1=number of unique operators
n2=number of unique operands
- Language Level - Shows the algorithm implementation program language level. The same algorithm demands additional effort if it is written in a low-level program language. For example, it is easier to program in Pascal than in Assembler.
L' = V / D / D
lambda = L * V* = L2 * V
Advantages:
- Predicts error rate.
- Predicts maintenance effort
- Simple to calculate
- Measure overall quality
- Used for any language
Disadvantages:
- Depends on complete code
- Complexity increases as program level decreases
- Difficult to compute
0 Comments