Halstead's Software MetricsAccording to Halstead's "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." Token CountIn these metrics, a computer program is considered to be a collection of tokens, which may be classified as either operators or operands. 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. In terms of the total tokens used, the size of the program can be expressed as N = N1 + N2. Halstead metrics are: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*log_{2}n 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 errorproneness (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 wellstructured 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^ = n1log_{2}n1 + n2log_{2}n2 The following alternate expressions have been published to estimate program length:
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*) * log_{2} (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 Language Level  Shows the algorithm implementation program language level. The same algorithm demands additional effort if it is written in a lowlevel program language. For example, it is easier to program in Pascal than in Assembler. L' = V / D / Dlambda = L * V* = L^{2} * V Language levels
Counting rules for C language
Example: Consider the sorting program as shown in fig: List out the operators and operands and also calculate the value of software science measure like n, N, V, E, λ ,etc. Solution: The list of operators and operands is given in the table
Here N1=53 and N2=38. The program length N=N1+N2=53+38=91 Vocabulary of the program n=n1+n2=14+10=24 Volume V= N * log_{2}N=91 x log_{2} 24=417 bits. The estimate program length N of the program = 14 log_{2}14+10 log_{2})10 Conceptually unique input and output parameters are represented by n2*. n2*=3 {x: array holding the integer to be sorted. This is used as both input and output} {N: the size of the array to be sorted} The Potential Volume V*=5log_{2}5=11.6 Since L=V*/V We may use another formula V^=V x L^= 417 x 0.038=15.67E^=V/L^=D^ x V Therefore, 10974 elementary mental discrimination is required to construct the program. This is probably a reasonable time to produce the program, which is very simple.
Next TopicFunctional Point (FP) Analysis

IoT
GraphQL
Xampp
Kivy
A. Anywhere
Ext.js
UiPath
Arduino
Digital E.
Adwords
MySQL
Python
Smartsheet
Affiliate M.