0% found this document useful (0 votes)
9 views31 pages

Slide 10

The document discusses Halstead's Software Metrics, which are measures to evaluate software complexity based on distinct operators and operands, and their limitations. It also covers Functional Point Analysis (FPA), a method for measuring software functionality and estimating development effort, along with its objectives and types. Additionally, it provides a detailed example of calculating Halstead metrics and function points for a given system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views31 pages

Slide 10

The document discusses Halstead's Software Metrics, which are measures to evaluate software complexity based on distinct operators and operands, and their limitations. It also covers Functional Point Analysis (FPA), a method for measuring software functionality and estimating development effort, along with its objectives and types. Additionally, it provides a detailed example of calculating Halstead metrics and function points for a given system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

CSE-327

Software Engineering
R U M A N A YA S M I N
LECTURER
CSE, BUBT
OFFICE – 407 (B3)
Reference Book
Chapter 30: Software Engineering: A Practitioner’s Approach – Roger S.
Pressman (8th Edition)
Halstead’s Software
Metrics
Halstead’s Software metrics are a set of measures proposed by Maurice
Halstead to evaluate the complexity of a software program.
These metrics are based on the number of distinct operators and
operands in the program and are used to estimate the effort required to
develop and maintain the program.
Halstead’s Software
Metrics
Halstead’s software metrics can be used to estimate the size,
complexity, and effort required to develop and maintain a software
program.
However, they have some limitations, such as the assumption that all
operators and operands are equally important, and the assumption that
the same set of metrics can be used for different programming
languages and development environments.
Halstead assigned quantitative laws to the development of computer
software, using a set of primitive measures that may be derived after
code is generated or estimated once design is complete.
The measures are:
n1 = Number of distinct operators.
n2 = Number of distinct operands.
N1 = Total number of occurrences of operators.
N2 = Total number of occurrences of operands.
Halstead Metrics
Program length (N): This is the total number of operator and operand occurrences
in the program, i.e., N = N1 + N2
And estimated program length is, N^ = n1 log2 n1 + n2 log2 n2
Purity ratio: PR = N^ /N
Vocabulary size (n): This is the total number of distinct operators and operands in
the program, i.e., n = n1 + n2
Program volume (V): This is the product of program length (N) and the logarithm of
vocabulary size (n), i.e., V = N*log2(n). The unit of measurement of volume is “bits”.
Program level (L): This is the ratio of the number of operator occurrences to the
number of operand occurrences in the program, i.e., L = n1/n2, where n1 is the
number of operator occurrences and n2 is the number of operand occurrences.
And estimated program level is L^ =2 * (n2) / (n1)(N2)
Halstead Metrics
Program difficulty (D): This is the ratio of the number of unique
operators to the total number of operators in the program, i.e., D =
(n1/2) * (N2/n2).
Program effort (E): This is the product of program volume (V) and
program difficulty (D), i.e., E = V*D.
Programming Time (T): Shows time (in minutes) needed to translate the
existing algorithm into implementation in the specified program
language.
T = E / (f * S)
Stroud number, S = 18 moments / second; seconds-to-minutes factor f =
60
Counting Rules for C
Language
1. Comments are not considered.
2. The identifier and function declarations are not considered
3. All the variables and constants are considered operands.
4. Global variables used in different modules of the same program are counted as
multiple occurrences of the same variable.
5. Local variables with the same name in different functions are counted as
unique operands.
6. Functions calls are considered operators.
7. All looping statements e.g., do {…} while ( ), while ( ) {…}, for ( ) {…}, all control
statements e.g., if ( ) {…}, if ( ) {…} else {…}, etc. are considered as operators.
8. In control construct switch ( ) {case:…}, switch as well as all the case statements
are considered as operators.
Counting Rules for C
Language
8. The reserve words like return, default, continue, break, size, etc., are considered
operators.
9. All the brackets, commas, and terminators are considered operators.
10. GOTO is counted as an operator and the label is counted as an operand.
11. The unary and binary occurrences of “+” and “-” are dealt with separately.
Similarly “*” (multiplication operator) is dealt with separately.
12. In the array variables such as “array-name [index]” “array-name” and “index” are
considered as operands and [ ] is considered as operator.
13. In the structure variables such as “struct-name, member-name” or “struct-name
-> member-name”, struct-name, and member-name are taken as operands, and
‘.’, ‘->’ are taken as operators. Some names of member elements in different
structure variables are counted as unique operands.
14. All the hash directives are ignored.
Evaluate the Halstead metrics.

int sort (int x[ ], int n)

{
int i, j, save, im1;
/*This function sorts array x in ascending order */
If (n< 2) return 1;
for (i=2; i< =n; i++)
{
im1=i-1;
for (j=1; j< =im1; j++)
if (x[i] < x[j])
{
Save = x[i];
x[i] = x[j];
x[j] = save;
}
}
return 0;
}
Operators Occurrences Operands Occurrences
int 4 sort 1
() 5 x 7
, 4 n 3
[] 7 i 8
if 2 j 7
< 2 save 3
; 11 im1 3
for 2 2 2
= 6 1 3
– 1 0 1
<= 2 – –
++ 2 – –
return 2 – –
{} 3 – –
n1=14 N1=53 n2=10 N2=38
Solution
N = 91
n = 24
V = 417.23 bits
N^ = 86.51
L = 0.027
D = 37.03
L^ = 0.038
T = 610 seconds
Halstead’s software metrics can be a useful tool for software developers
and project managers to estimate the effort required to develop and
maintain software programs.
References
https://www.geeksforgeeks.org/software-engineering-halsteads-softwa
re-metrics/
https://www.javatpoint.com/software-engineering-halsteads-software-
metrics
https://www.tutorialandexample.com/software-engineering-halsteads-s
oftware-metrics
Functional Point (FP)
Analysis
The function point (FP) metric can be used effectively as a means for
measuring the functionality delivered by a system.
Using historical data, the FP metric can then be used to
(1) estimate the cost or effort required to design, code, and test the
software;
(2) predict the number of errors that will be encountered during testing;
and
(3) forecast the number of components and/or the number of projected
source lines in the implemented system.
Objectives of Functional Point
Analysis
The objective of FPA is to measure the functionality that the user
requests and receives.
The objective of FPA is to measure software development and
maintenance independently of the technology used for
implementation.
It should be simple enough to minimize the overhead of the
measurement process.
It should be a consistent measure among various projects and
organizations.
Types of Functional
Point Analysis
Transactional Functional Type
Data Functional Type
Transactional Functional
Type
External Input (EI): EI is an elementary process that controls
information that comes from outside the application’s boundary.
External Output (EO): EO is an elementary process that generates data
or control information sent outside the application’s boundary.
External Inquiries (EQ): EQ is an elementary process made up of an
input-output combination that results in data retrieval.
Data Functional Type
Internal Logical File (ILF): A user-identifiable group of logically related
data or control information maintained within the boundary of the
application.
External Interface File (EIF): A group of users recognizable logically
related data allusion to the software but maintained within the
boundary of another software. The data is completely outside the
application boundaries and is maintained by external inputs from other
apps.
An internal logical file for another application houses the external
interface file. A file can only be counted as an EIF or ILF by one
application, not both.
FP Attributes
We calculate the functional point with the help of the number of functions
and types of functions used in applications. These are classified into five types.

Measurement Parameters Examples

Number of External Inputs (EI) Input screen and tables

Number of External Output (EO) Output screens and reports

Number of external inquiries (EQ) Prompts and interrupts

Number of internal files (ILF) Databases and directories

Number of external interfaces (EIF) Shared databases and shared routines


Weights of 5 Functional
Point Attributes
Measurement Parameter Low/Simple Average High/Complex

Number of external inputs (EI) 3 4 6

Number of external outputs


4 5 7
(EO)

Number of external inquiries


3 4 6
(EQ)

Number of internal files (ILF) 7 10 15

Number of External Interfaces


5 7 10
(EIF)
To compute function points (FP), the following relationship is used:

FP = count total * [0.65 + 0.01 * ⅀ ( Fi)]

UFP CAF
Unadjusted Function Point Complexity Adjustment Factor

where count total is the sum of all FP entries obtained from Figure 30.1 .
and ∑Fi = 14 * VAF
The Fi ( i = 1 to 14) are value adjustment factors (VAF) based on responses to
the following 14 questions:

1. Does the system require reliable backup and recovery?


2. Are specialized data communications required to transfer information to or from the application?
3. Are there distributed processing functions?
4. Is performance critical?
5. Will the system run in an existing, heavily utilized operational environment?
6. Does the system require online data entry?
7. Does the online data entry require the input transaction to be built over multiple screens or
operations?
8. Are the ILFs updated online?
9. Are the inputs, outputs, fi les, or inquiries complex?
10. Is the internal processing complex?
11. Is the code designed to be reusable?
12. Are conversion and installation included in the design?
13. Is the system designed for multiple installations in different organizations?
14. Is the application designed to facilitate change and ease of use by the user?
Values for VAF
VAF (Absolutely essential) = 5.0
VAF (Moderately Complex) = 3.2857
VAF (Average) = 2.5
VAF (Not important/not essential) = 0
Example
Example
The count total shown in Figure 30.3 must be adjusted using Equation
to calculate FP.
For the purposes of this example, we calculate the ∑Fi for a moderately
complex product.
Therefore,
∑Fi = 14 * 3.2857 = 45.9998 = 46 (approximately)
FP = 50 * [0.65 + (0.01 * 46)] = 56
Task
Suppose, a system has 30 external inputs, 60 external outputs fields,
and 23 different external queries manage 9 internal logical files and
interfaces with 6 different legacy systems.
Calculate function point (FP) metric while considering the parameter of
complexity as complex and value adjustment factor (VAF) as absolutely
essential.
References
https://www.geeksforgeeks.org/software-engineering-functional-point-f
p-analysis/
https://www.codingninjas.com/studio/library/functional-point-fp-analys
is-in-software-engineering

You might also like