SlideShare a Scribd company logo
1 of 16
Download to read offline
Software Engineering (KCS-601)
Unit-3 (Second Part): Software Metrics
Dr. Radhey Shyam
Professor
Department of Computer Science and Engineering
SRMCEM Lucknow
(Affiliated to Dr. A.P.J. Abdul Kalam Technical University, Lucknow)
Unit-3 (Second part) have been compiled/prepared by Dr. Radhey Shyam, with grateful acknowledgment
who made their course contents freely available or (Contributed directly or indirectly). Feel free to use this
study material for your own academic purposes. For any query, the communication can be made through
this mail shyam0058@gmail.com.
April 18, 2022
Soktwahe Moi
LAtuanr Meic o a
e L
ChaadTe ietis wi a guaru
Cautalle
Cturan
m
u u a d i i b l e
tale Mtsics ane wpetat o n a n
acens nelmdin
Penomanee, lamm n w lomo M
pmdutliwit, a mam tha uCea,
Meacun n
7Maio ahe an imotant Coen
ualt acsuramu Manasemot debus
iming e ano
mami
a valnalle tr bth devlAare a
denel mot am lendars,
e n a dieren setw MaT
O RLad sAtwane MDit eyelmdlic
Cala funlow Poinh and LoC
matrics, Cnebv
FP and Loc bas
elatinel
LOT a g.nelia of Colo
Course Name: M. Tech Halto AAsae sei C
A
aetaralt rdiclod wa
t o u n
Semester: 2nd Logk N, t N
Paper Name: Object Oriented Software Engineering (MTCS-203B) 7
Topic: Halstead's Software Science. ocahulay7,f n
wlam N
Halstead's SoftwareScience
Halstead's Software Science
Halstead's complexity measurement was developed to measure a program module's complexiny
directly from source code, with emphasis on
computational complexity.
The Halstead's measures are based on four scalar number derived directly from a program s
source code:
n 1S number of distinct operators.
n2 is number of distinct operands.
eurYante v
Ni is total number of/distinct operators.
N is total number ofdistinct operands
From these numbers, five measures are derived:
Measure Symbol Formula
Program length N N=NI +Na
Programvocabulary N n=nitn2
Volume V=N* (log2 n)
Difficulty D D (n1/2)*(N2/2)
Effort E E=D*V
iaistead's uses certain measures such as program length, program vocabulary, v
difficulty, and effort for the given algorithm. By this Halstead's is trying to show that une
program length can be caleulated, volume of algorithm can be estimated. The above given table
shows how actually these measure can be obtained.
The Halstead's measures are applicable to operational system and to development eforts once
the code has been written. Thus using Halstead's measurement experimental verification can be
performed in software science.
Program length:
The length of a program is total usage of operators and operands in the program.
Length (N) =Ni+N2
Program vocabulary:
The Program vocabulary is the number of unique operators and operands used in the program.
Vocabulary (n) = ni t n2
Program Volume:
The Program Volume can be defined as minimum number of bits needed to encode the program.
Volume (V) = N loga n
Length estimation:
N=ni log2 ni t n2 log2 n2
Guideline for caleulating operands and operators:
1. All the variables and constants are considered as operands.
2. Local variables with same name, if occurring in different functions are counted as unique
operand.
3. Function calls are considered as operators.
4 The looping statements, do... while, while, for, are operators. The statements i, i
else, are operators. The switch . . .
case statements are considered as operators.
5. The reserve worlds, returns, default, continue, break, sizeof are all operators.
6. The brackets, commas, semicolons, are operators.
7. The unary and binary operators are considered as operators. The & is considered
as
operator.
8. In arrays, array name and index are considered as operands and [ ] is considered
as
operator.
9. All hash directives can be ignored.
10. Comments are not considered.
11. In Goto statement, goto is considered as operatorand label as operand.
Example: Obtain Halstead's length and volume measure for following C function.
)
(CtinatashengtE
Void swap (int a[ ], int i)
uelwme N n
int temp;
Fr Comptalia H a l s a r e l ' s
m e
bistineF eporators ) {Fi
ne efperards; K 2 3
= -N=)
Temp ali
ail ali+1];:
afi+1]=temp; legti N) =
N,tNa=lct
17
pLabulayln)= n,#n2 = 8t4=12
N=10
We first find out the operands and operators from above function along with their occurrences.
Operands Occurrences Operators Occurrences
swap
5
void
temp
int 3
4
3
2
N-21
Na
Caledali HaltEmdnpluma lo
w
# GCD lopuldio
n geel (,1)
n2=9
N 16
n=5
N=Ni+N:
=
16+21 =37
rtile(= t)
N=37
n =nitn2
=
5 +9 =
14
d
-T-
n= 14
Estimated length =
n1 log ni + n2 log n2
=
5 iog 5 +9 log 93 . 1 1
= 5*2.32 +9*2.19 =31.37
GrpeTands eumemeas oralnd |aelunen
Estimated length =
31.37
whde
VolumeN * log n
Y
M
37 *
log (14) d de
381
elu
37*2.63=97.64
3
Volume (V) =
97.64
3
33
13 2
n
n,+) 3t13 - I6 2
NI =
14.Na 20
Estima longt =
, t73
N=
N+ N,= l4+20 = 3
Rume z
34x 6)
34x 136
3 3+ 13up13
3(1.58S)+ 13(3-))
=S2
t le uaattalne
Opelemalt lopleyi
MeaswR t t mumos "k uneavy imdelouda
Pacte e Cole. 'maidy u t e y a l u a t e
Compay oa p
ase ase mt ho Coployy
Cn be lomleitad tngly f+low
V(G)=e -n+2f He 'oth m
t mo. des, and p
T R
na,
6 Cewwnaitd Comaemanb.
4) Hene
Po e mo. TdCa
o d e ,
(11 v(4)= No. agions
&. Copul yelemue Cerkae us floin
CL=
e -
nt2
= 8
1 0
CoReee e
VG)=lo - 8+2
umda
2+2
4
e l c e
(vC) 7.
1 V(G Monr aA
me lemfpla
(
E a - l P
i0
wtlCicn-1)d
i+1:
wil(i4 n) do
Ai) 4A(1)
Surp (ACi) AU
i+1
e d.
Compute eyelsnaiu abeue lnsrapy
CLat v¢) o abe 9s.
U N C T I O N POINT
ystv la. mlboms, ap2,
wobuts
olusaluen
m a m u m m
ond
m u n m u n ,
MLbucs a ptouclsup
khimolio
u a n s l i t
Th peg.2el. soblesn and
d l e r e l a f l A h b r B c l u c l
MloLLLALL
o u t a n d p o p u l e r 4
l u e r i m l l y
b l u n g u L L d
pund
)Euncluafa peuul
lo2einaleBge
otes_LoC)
Ladis
a v a i l a k L _
t e L l h m a L L
Thu
m i l u c
L a & L L k e R
The
TLpuettc_by
c e u M l u s
A
M M A N A =
SeLLAcLImLLlucluennlUn Ahe
a l l
/ m e l u c i s
d u a l o k n c d h e a s u a n
W h u l l C
c o i n L u s n g
hl Ma
imsluuciera, luaps_nedat_communluny
th
cOd AMd
hindur/_lnsaKLA9mg/u
Aoc hastkellewas)sherlcennin8
OC
Loc
a l u m l e u c a l
ualue (e
oc
Jeblom
e h a t saM May
wrdily
May wdaly
dlfaluesmt
ithindudkcal
codin STyle.0
dfaUnen
preisammusay wiÍAeAcOtelI.n
dhfewnl wayllsFA Lg Om seavW
paLeawm
Reutal Bowmce mklnuub
MnRAwhuak amathpp
Lng M3uln
a-
LAMg{
acluos8
oC Aunlal kles
aclun mLas _ol h codn
900d alsnl Om Th/ Dthn honmd,
O 900d bupblum
BheullK
e
DAUL COMMaleu Akplal llplmincdhd
LA MUal L
LLL9M CAde lhtll,Elc_am
LoC hewluue ocuL
Lh
LAdng0clwly alrn
CAAmLpAulus
MUoky
hs
imalpiugMa_n
ce lais_haoly lh
Ahe aualils_amd liotmcys//EhL
MIsauily( wnply kati auabtu
highi ndy
u lamalunes
kurel Aannjual
hughi
L E N L L y _
heha th_doc coundwll
Thsuweudd AhuA8a
L m a l l p r R a M M A
asglo2us8AuL_hr doCceu as
measulee
h lal pul un
dllueml/deselghalus,_thy weula.
a
C o d e l u s e b l d u r l e
b dis Vceunagm
Page2-
wUuy dllucull nal o p
Alumali Jod/U Che
accutal p.
Che buob lemn
A0Ccoul ca
specAlca)
OMA
Cempuld 0nly
bcemJullyfdevn Le
mama9.eLS
dusun hsotr.cl la
amy hvelol, 4
e l CUMU-be/øm
aclurty
h a l s L l a s i l j d
6199.c8L
th ZoC 0nelile
h o t l c o r
em he
M A m a e b e n s p i C l u V
peml melbuic
Mluc
houlceminIS
umcEM.
Funche boiint
maMy
m.gliuc LSuncids
late 1970 'S uNcZien
nta Aehulalpiy
ueposkd_by ALbuchM
h
isnportamt aduamlojA3 Lt
mcluen peun AMTLUc/ Au
lhalt CaM
LLnatl hiiac walp
LeducZ
LLclLcalue
diuctly am he Vpuebi
ncpiuo Lcaobihna
ABCLCiy
Page3 6
A
dapundemt
Lu JumcluoLS gt
h
Asetwant oduct Supporlin
lanfe
.
aluslksLwolLd
S Lhama bsoclucl
Lialuste
ia ads some
lasle
Cdaumly
tvnlh Qess no
whna
Lach
dala amd Uan
Siommsd LO he coHespondm? _eutpul
mclon
dala
PumdernemtMetuc
parammmlesus
No f
Ne
uspil/s
Na Na
nalliius ales
No:1-
ntnlaces
FP
UFP * TCF
Umoduslaol
EumclueM
Pomls
Lechancal
Compleaiy
Facle
TCF 0 65 0:01 X DL
degLe
imlluhace
Dbndent M14paranmelsuswtuch
A8gmid walue
Lathocie )No S49milnul
Imodlnla
Moduroti
OL N psLl No nm
5LStMgInlluim
4 Na Abuls
ach data lum mpul by
2 No lpu
Lach_Ldala lem
eilput by hs p
SNo LAAQLLIHILL
No lduimcd intiuaclue quLrLLs hch
caM
4No
A Lhal (l Aapluus a ueup AoLucally
uldltid
5-lo
h JAtindad MAIl lenchaWge
L malueA h Ahn &yilnns.
MAdL
Udolakogucal llsuinclucll(Aala such
phypical ils
Fals Snapl Aa2Cemslo
6
NoInpuI 3
5
Outpub 1
3 6
10 15
Fl13
5
Wgnt Chart
D I
No awpuls
Dulpuls
S2
11
Lalomal
(unlreacrs
91
Atuat
Sinple =21 7
Cowola aFumeiow PoiT value a
d e m a i n h r a s l e n u c o
NCo - UCe inau : 3 2
No u bab= to
Lo ue 'imqiYi=24
NO laa ales tales = 2
e nal
Assma
Wat Compleriq asaton
aln Page6
Me
FP UEPx TCf then. FP
funelion loint UFP v ugte
a a uasjuttod fanaaon pbintE
amTfCbat+eebnicalCapisqG
ata a Di io do
inl e n r
h c e banameark a Copatad a
EP4x 37+hox54xto424Y+Yrz
UFP= 4*32 + o*5+2-4 * + 8* 1ot 7*2
TeF= o.65+O:DI *DI
DT= 4*3= y2
618 1 o)
= 661.2
n O S - T T . C
References
1. Roger S. Pressman, Software Engineering a Practitioner Approach, 3rd
Edition, TMH, 2005.
2. Rajib Mall, Fundamantal of Software Engineering, 3rd
Edition,PHI Publication, 2007.
3. Deepak Jain, Software Engineering for Practitioners, Ist
Edition, Oxford, 2012.
4. K K Agarwal and Yogesh Singh, Software Engineering, 3rd
Edition,Oxford, 2012.
********************
16

More Related Content

Similar to Software Metrics and Halstead's Software Science

JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component Marialaura Bancheri
 
GEOframe-NewAge: documentation for probabilitiesbackward component
GEOframe-NewAge: documentation for probabilitiesbackward componentGEOframe-NewAge: documentation for probabilitiesbackward component
GEOframe-NewAge: documentation for probabilitiesbackward componentMarialaura Bancheri
 
Lecture 03 algorithm analysis
Lecture 03 algorithm analysisLecture 03 algorithm analysis
Lecture 03 algorithm analysisNurjahan Nipa
 
Oscar Nieves (11710858) Computational Physics Project - Inverted Pendulum
Oscar Nieves (11710858) Computational Physics Project - Inverted PendulumOscar Nieves (11710858) Computational Physics Project - Inverted Pendulum
Oscar Nieves (11710858) Computational Physics Project - Inverted PendulumOscar Nieves
 
OPERATION RESEARCH_Cheat sheets.pdf
OPERATION RESEARCH_Cheat sheets.pdfOPERATION RESEARCH_Cheat sheets.pdf
OPERATION RESEARCH_Cheat sheets.pdfRoopaDNDandally
 
An Evaluation Of Motor Models Of Handwriting
An Evaluation Of Motor Models Of HandwritingAn Evaluation Of Motor Models Of Handwriting
An Evaluation Of Motor Models Of HandwritingJoaquin Hamad
 
Design of State Estimator for a Class of Generalized Chaotic Systems
Design of State Estimator for a Class of Generalized Chaotic SystemsDesign of State Estimator for a Class of Generalized Chaotic Systems
Design of State Estimator for a Class of Generalized Chaotic Systemsijtsrd
 
An Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSPAn Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSPSougata Das
 
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITION
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITIONSEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITION
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITIONcscpconf
 
Class 12 Physics Notes
Class 12 Physics NotesClass 12 Physics Notes
Class 12 Physics NotesBasantSheoran
 
Critical path method (CPM).pptx
Critical path method (CPM).pptxCritical path method (CPM).pptx
Critical path method (CPM).pptxHimanshuKaklotar1
 
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...Satyendra Singh
 
Mechanical waves.pdf
Mechanical waves.pdfMechanical waves.pdf
Mechanical waves.pdfssuser441bdc
 
Efficiency of recurrent neural networks for seasonal trended time series mode...
Efficiency of recurrent neural networks for seasonal trended time series mode...Efficiency of recurrent neural networks for seasonal trended time series mode...
Efficiency of recurrent neural networks for seasonal trended time series mode...IJECEIAES
 

Similar to Software Metrics and Halstead's Software Science (20)

multiscale_tutorial.pdf
multiscale_tutorial.pdfmultiscale_tutorial.pdf
multiscale_tutorial.pdf
 
JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component
 
GEOframe-NewAge: documentation for probabilitiesbackward component
GEOframe-NewAge: documentation for probabilitiesbackward componentGEOframe-NewAge: documentation for probabilitiesbackward component
GEOframe-NewAge: documentation for probabilitiesbackward component
 
133501854 d-j-ewins-modal-testing-theory-and-practice
133501854 d-j-ewins-modal-testing-theory-and-practice133501854 d-j-ewins-modal-testing-theory-and-practice
133501854 d-j-ewins-modal-testing-theory-and-practice
 
Lecture 03 algorithm analysis
Lecture 03 algorithm analysisLecture 03 algorithm analysis
Lecture 03 algorithm analysis
 
Oscar Nieves (11710858) Computational Physics Project - Inverted Pendulum
Oscar Nieves (11710858) Computational Physics Project - Inverted PendulumOscar Nieves (11710858) Computational Physics Project - Inverted Pendulum
Oscar Nieves (11710858) Computational Physics Project - Inverted Pendulum
 
OPERATION RESEARCH_Cheat sheets.pdf
OPERATION RESEARCH_Cheat sheets.pdfOPERATION RESEARCH_Cheat sheets.pdf
OPERATION RESEARCH_Cheat sheets.pdf
 
An Evaluation Of Motor Models Of Handwriting
An Evaluation Of Motor Models Of HandwritingAn Evaluation Of Motor Models Of Handwriting
An Evaluation Of Motor Models Of Handwriting
 
Design of State Estimator for a Class of Generalized Chaotic Systems
Design of State Estimator for a Class of Generalized Chaotic SystemsDesign of State Estimator for a Class of Generalized Chaotic Systems
Design of State Estimator for a Class of Generalized Chaotic Systems
 
Lesson 11 1
Lesson 11  1Lesson 11  1
Lesson 11 1
 
An Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSPAn Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSP
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
unit-4.pdf
unit-4.pdfunit-4.pdf
unit-4.pdf
 
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITION
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITIONSEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITION
SEMANTIC STUDIES OF A SYNCHRONOUS APPROACH TO ACTIVITY RECOGNITION
 
Class 12 Physics Notes
Class 12 Physics NotesClass 12 Physics Notes
Class 12 Physics Notes
 
Fluid Mechanics_first half.pdf
Fluid Mechanics_first half.pdfFluid Mechanics_first half.pdf
Fluid Mechanics_first half.pdf
 
Critical path method (CPM).pptx
Critical path method (CPM).pptxCritical path method (CPM).pptx
Critical path method (CPM).pptx
 
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...
PuShort Term Hydrothermal Scheduling using Evolutionary Programmingblished pa...
 
Mechanical waves.pdf
Mechanical waves.pdfMechanical waves.pdf
Mechanical waves.pdf
 
Efficiency of recurrent neural networks for seasonal trended time series mode...
Efficiency of recurrent neural networks for seasonal trended time series mode...Efficiency of recurrent neural networks for seasonal trended time series mode...
Efficiency of recurrent neural networks for seasonal trended time series mode...
 

More from Dr. Radhey Shyam

KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdf
KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdfKIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdf
KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdfDr. Radhey Shyam
 
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdf
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdfSE-UNIT-3-II-Software metrics, numerical and their solutions.pdf
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdfDr. Radhey Shyam
 
Introduction to Data Analytics and data analytics life cycle
Introduction to Data Analytics and data analytics life cycleIntroduction to Data Analytics and data analytics life cycle
Introduction to Data Analytics and data analytics life cycleDr. Radhey Shyam
 
KIT-601 Lecture Notes-UNIT-2.pdf
KIT-601 Lecture Notes-UNIT-2.pdfKIT-601 Lecture Notes-UNIT-2.pdf
KIT-601 Lecture Notes-UNIT-2.pdfDr. Radhey Shyam
 
KIT-601 Lecture Notes-UNIT-1.pdf
KIT-601 Lecture Notes-UNIT-1.pdfKIT-601 Lecture Notes-UNIT-1.pdf
KIT-601 Lecture Notes-UNIT-1.pdfDr. Radhey Shyam
 
Deep-Learning-2017-Lecture5CNN.pptx
Deep-Learning-2017-Lecture5CNN.pptxDeep-Learning-2017-Lecture5CNN.pptx
Deep-Learning-2017-Lecture5CNN.pptxDr. Radhey Shyam
 
Ip unit 4 modified on 22.06.21
Ip unit 4 modified on 22.06.21Ip unit 4 modified on 22.06.21
Ip unit 4 modified on 22.06.21Dr. Radhey Shyam
 
Ip unit 3 modified of 26.06.2021
Ip unit 3 modified of 26.06.2021Ip unit 3 modified of 26.06.2021
Ip unit 3 modified of 26.06.2021Dr. Radhey Shyam
 
Ip unit 2 modified on 8.6.2021
Ip unit 2 modified on 8.6.2021Ip unit 2 modified on 8.6.2021
Ip unit 2 modified on 8.6.2021Dr. Radhey Shyam
 

More from Dr. Radhey Shyam (20)

KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdf
KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdfKIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdf
KIT-601-L-UNIT-1 (Revised) Introduction to Data Analytcs.pdf
 
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdf
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdfSE-UNIT-3-II-Software metrics, numerical and their solutions.pdf
SE-UNIT-3-II-Software metrics, numerical and their solutions.pdf
 
Introduction to Data Analytics and data analytics life cycle
Introduction to Data Analytics and data analytics life cycleIntroduction to Data Analytics and data analytics life cycle
Introduction to Data Analytics and data analytics life cycle
 
KCS-501-3.pdf
KCS-501-3.pdfKCS-501-3.pdf
KCS-501-3.pdf
 
KIT-601 Lecture Notes-UNIT-2.pdf
KIT-601 Lecture Notes-UNIT-2.pdfKIT-601 Lecture Notes-UNIT-2.pdf
KIT-601 Lecture Notes-UNIT-2.pdf
 
KIT-601 Lecture Notes-UNIT-1.pdf
KIT-601 Lecture Notes-UNIT-1.pdfKIT-601 Lecture Notes-UNIT-1.pdf
KIT-601 Lecture Notes-UNIT-1.pdf
 
KCS-055 U5.pdf
KCS-055 U5.pdfKCS-055 U5.pdf
KCS-055 U5.pdf
 
KCS-055 MLT U4.pdf
KCS-055 MLT U4.pdfKCS-055 MLT U4.pdf
KCS-055 MLT U4.pdf
 
Deep-Learning-2017-Lecture5CNN.pptx
Deep-Learning-2017-Lecture5CNN.pptxDeep-Learning-2017-Lecture5CNN.pptx
Deep-Learning-2017-Lecture5CNN.pptx
 
SE UNIT-2.pdf
SE UNIT-2.pdfSE UNIT-2.pdf
SE UNIT-2.pdf
 
SE UNIT-1 Revised.pdf
SE UNIT-1 Revised.pdfSE UNIT-1 Revised.pdf
SE UNIT-1 Revised.pdf
 
SE UNIT-3.pdf
SE UNIT-3.pdfSE UNIT-3.pdf
SE UNIT-3.pdf
 
Ip unit 5
Ip unit 5Ip unit 5
Ip unit 5
 
Ip unit 4 modified on 22.06.21
Ip unit 4 modified on 22.06.21Ip unit 4 modified on 22.06.21
Ip unit 4 modified on 22.06.21
 
Ip unit 3 modified of 26.06.2021
Ip unit 3 modified of 26.06.2021Ip unit 3 modified of 26.06.2021
Ip unit 3 modified of 26.06.2021
 
Ip unit 2 modified on 8.6.2021
Ip unit 2 modified on 8.6.2021Ip unit 2 modified on 8.6.2021
Ip unit 2 modified on 8.6.2021
 
Ip unit 1
Ip unit 1Ip unit 1
Ip unit 1
 
Cc unit 5
Cc unit 5Cc unit 5
Cc unit 5
 
Cc unit 4 updated version
Cc unit 4 updated versionCc unit 4 updated version
Cc unit 4 updated version
 
Cc unit 3 updated version
Cc unit 3 updated versionCc unit 3 updated version
Cc unit 3 updated version
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 

Software Metrics and Halstead's Software Science

  • 1. Software Engineering (KCS-601) Unit-3 (Second Part): Software Metrics Dr. Radhey Shyam Professor Department of Computer Science and Engineering SRMCEM Lucknow (Affiliated to Dr. A.P.J. Abdul Kalam Technical University, Lucknow) Unit-3 (Second part) have been compiled/prepared by Dr. Radhey Shyam, with grateful acknowledgment who made their course contents freely available or (Contributed directly or indirectly). Feel free to use this study material for your own academic purposes. For any query, the communication can be made through this mail shyam0058@gmail.com. April 18, 2022
  • 2. Soktwahe Moi LAtuanr Meic o a e L ChaadTe ietis wi a guaru Cautalle Cturan m u u a d i i b l e tale Mtsics ane wpetat o n a n acens nelmdin Penomanee, lamm n w lomo M pmdutliwit, a mam tha uCea, Meacun n 7Maio ahe an imotant Coen ualt acsuramu Manasemot debus iming e ano mami a valnalle tr bth devlAare a denel mot am lendars, e n a dieren setw MaT O RLad sAtwane MDit eyelmdlic Cala funlow Poinh and LoC matrics, Cnebv
  • 3. FP and Loc bas elatinel LOT a g.nelia of Colo Course Name: M. Tech Halto AAsae sei C A aetaralt rdiclod wa t o u n Semester: 2nd Logk N, t N Paper Name: Object Oriented Software Engineering (MTCS-203B) 7 Topic: Halstead's Software Science. ocahulay7,f n wlam N Halstead's SoftwareScience Halstead's Software Science Halstead's complexity measurement was developed to measure a program module's complexiny directly from source code, with emphasis on computational complexity. The Halstead's measures are based on four scalar number derived directly from a program s source code: n 1S number of distinct operators. n2 is number of distinct operands. eurYante v Ni is total number of/distinct operators. N is total number ofdistinct operands From these numbers, five measures are derived: Measure Symbol Formula Program length N N=NI +Na Programvocabulary N n=nitn2 Volume V=N* (log2 n) Difficulty D D (n1/2)*(N2/2) Effort E E=D*V
  • 4. iaistead's uses certain measures such as program length, program vocabulary, v difficulty, and effort for the given algorithm. By this Halstead's is trying to show that une program length can be caleulated, volume of algorithm can be estimated. The above given table shows how actually these measure can be obtained. The Halstead's measures are applicable to operational system and to development eforts once the code has been written. Thus using Halstead's measurement experimental verification can be performed in software science. Program length: The length of a program is total usage of operators and operands in the program. Length (N) =Ni+N2 Program vocabulary: The Program vocabulary is the number of unique operators and operands used in the program. Vocabulary (n) = ni t n2 Program Volume: The Program Volume can be defined as minimum number of bits needed to encode the program. Volume (V) = N loga n Length estimation: N=ni log2 ni t n2 log2 n2 Guideline for caleulating operands and operators: 1. All the variables and constants are considered as operands. 2. Local variables with same name, if occurring in different functions are counted as unique operand. 3. Function calls are considered as operators.
  • 5. 4 The looping statements, do... while, while, for, are operators. The statements i, i else, are operators. The switch . . . case statements are considered as operators. 5. The reserve worlds, returns, default, continue, break, sizeof are all operators. 6. The brackets, commas, semicolons, are operators. 7. The unary and binary operators are considered as operators. The & is considered as operator. 8. In arrays, array name and index are considered as operands and [ ] is considered as operator. 9. All hash directives can be ignored. 10. Comments are not considered. 11. In Goto statement, goto is considered as operatorand label as operand. Example: Obtain Halstead's length and volume measure for following C function. ) (CtinatashengtE Void swap (int a[ ], int i) uelwme N n int temp; Fr Comptalia H a l s a r e l ' s m e bistineF eporators ) {Fi ne efperards; K 2 3 = -N=) Temp ali ail ali+1];: afi+1]=temp; legti N) = N,tNa=lct 17 pLabulayln)= n,#n2 = 8t4=12 N=10 We first find out the operands and operators from above function along with their occurrences. Operands Occurrences Operators Occurrences swap 5 void temp int 3
  • 6. 4 3 2 N-21 Na Caledali HaltEmdnpluma lo w # GCD lopuldio n geel (,1) n2=9 N 16 n=5 N=Ni+N: = 16+21 =37 rtile(= t) N=37 n =nitn2 = 5 +9 = 14 d -T- n= 14 Estimated length = n1 log ni + n2 log n2 = 5 iog 5 +9 log 93 . 1 1 = 5*2.32 +9*2.19 =31.37 GrpeTands eumemeas oralnd |aelunen Estimated length = 31.37 whde VolumeN * log n Y M 37 * log (14) d de 381 elu 37*2.63=97.64 3 Volume (V) = 97.64 3 33 13 2 n n,+) 3t13 - I6 2 NI = 14.Na 20 Estima longt = , t73 N= N+ N,= l4+20 = 3 Rume z 34x 6) 34x 136 3 3+ 13up13 3(1.58S)+ 13(3-)) =S2
  • 7. t le uaattalne Opelemalt lopleyi MeaswR t t mumos "k uneavy imdelouda Pacte e Cole. 'maidy u t e y a l u a t e Compay oa p ase ase mt ho Coployy Cn be lomleitad tngly f+low V(G)=e -n+2f He 'oth m t mo. des, and p T R na, 6 Cewwnaitd Comaemanb. 4) Hene Po e mo. TdCa o d e , (11 v(4)= No. agions &. Copul yelemue Cerkae us floin CL= e - nt2 = 8 1 0 CoReee e VG)=lo - 8+2 umda 2+2 4 e l c e (vC) 7. 1 V(G Monr aA me lemfpla (
  • 8. E a - l P i0 wtlCicn-1)d i+1: wil(i4 n) do Ai) 4A(1) Surp (ACi) AU i+1 e d. Compute eyelsnaiu abeue lnsrapy CLat v¢) o abe 9s.
  • 9. U N C T I O N POINT ystv la. mlboms, ap2, wobuts olusaluen m a m u m m ond m u n m u n , MLbucs a ptouclsup khimolio u a n s l i t Th peg.2el. soblesn and d l e r e l a f l A h b r B c l u c l MloLLLALL o u t a n d p o p u l e r 4 l u e r i m l l y b l u n g u L L d pund )Euncluafa peuul lo2einaleBge otes_LoC) Ladis a v a i l a k L _ t e L l h m a L L Thu m i l u c L a & L L k e R The TLpuettc_by c e u M l u s A M M A N A = SeLLAcLImLLlucluennlUn Ahe a l l / m e l u c i s d u a l o k n c d h e a s u a n W h u l l C c o i n L u s n g hl Ma imsluuciera, luaps_nedat_communluny th cOd AMd hindur/_lnsaKLA9mg/u Aoc hastkellewas)sherlcennin8 OC Loc a l u m l e u c a l ualue (e oc Jeblom e h a t saM May wrdily May wdaly dlfaluesmt ithindudkcal codin STyle.0 dfaUnen preisammusay wiÍAeAcOtelI.n dhfewnl wayllsFA Lg Om seavW paLeawm
  • 10. Reutal Bowmce mklnuub MnRAwhuak amathpp Lng M3uln a- LAMg{ acluos8 oC Aunlal kles aclun mLas _ol h codn 900d alsnl Om Th/ Dthn honmd, O 900d bupblum BheullK e DAUL COMMaleu Akplal llplmincdhd LA MUal L LLL9M CAde lhtll,Elc_am LoC hewluue ocuL Lh LAdng0clwly alrn CAAmLpAulus MUoky hs imalpiugMa_n ce lais_haoly lh Ahe aualils_amd liotmcys//EhL MIsauily( wnply kati auabtu highi ndy u lamalunes kurel Aannjual hughi L E N L L y _ heha th_doc coundwll Thsuweudd AhuA8a L m a l l p r R a M M A asglo2us8AuL_hr doCceu as measulee h lal pul un dllueml/deselghalus,_thy weula. a C o d e l u s e b l d u r l e b dis Vceunagm Page2-
  • 11. wUuy dllucull nal o p Alumali Jod/U Che accutal p. Che buob lemn A0Ccoul ca specAlca) OMA Cempuld 0nly bcemJullyfdevn Le mama9.eLS dusun hsotr.cl la amy hvelol, 4 e l CUMU-be/øm aclurty h a l s L l a s i l j d 6199.c8L th ZoC 0nelile h o t l c o r em he M A m a e b e n s p i C l u V peml melbuic Mluc houlceminIS umcEM. Funche boiint maMy m.gliuc LSuncids late 1970 'S uNcZien nta Aehulalpiy ueposkd_by ALbuchM h isnportamt aduamlojA3 Lt mcluen peun AMTLUc/ Au lhalt CaM LLnatl hiiac walp LeducZ LLclLcalue diuctly am he Vpuebi ncpiuo Lcaobihna ABCLCiy Page3 6
  • 12. A dapundemt Lu JumcluoLS gt h Asetwant oduct Supporlin lanfe . aluslksLwolLd S Lhama bsoclucl Lialuste ia ads some lasle Cdaumly tvnlh Qess no whna Lach dala amd Uan Siommsd LO he coHespondm? _eutpul mclon dala PumdernemtMetuc parammmlesus No f Ne uspil/s Na Na nalliius ales No:1- ntnlaces FP UFP * TCF Umoduslaol EumclueM Pomls Lechancal Compleaiy Facle TCF 0 65 0:01 X DL degLe imlluhace Dbndent M14paranmelsuswtuch A8gmid walue
  • 13. Lathocie )No S49milnul Imodlnla Moduroti OL N psLl No nm 5LStMgInlluim 4 Na Abuls ach data lum mpul by 2 No lpu Lach_Ldala lem eilput by hs p SNo LAAQLLIHILL No lduimcd intiuaclue quLrLLs hch caM 4No A Lhal (l Aapluus a ueup AoLucally uldltid 5-lo h JAtindad MAIl lenchaWge L malueA h Ahn &yilnns. MAdL Udolakogucal llsuinclucll(Aala such phypical ils Fals Snapl Aa2Cemslo 6 NoInpuI 3 5 Outpub 1 3 6 10 15 Fl13 5 Wgnt Chart
  • 14. D I No awpuls Dulpuls S2 11 Lalomal (unlreacrs 91 Atuat Sinple =21 7 Cowola aFumeiow PoiT value a d e m a i n h r a s l e n u c o NCo - UCe inau : 3 2 No u bab= to Lo ue 'imqiYi=24 NO laa ales tales = 2 e nal Assma Wat Compleriq asaton aln Page6 Me
  • 15. FP UEPx TCf then. FP funelion loint UFP v ugte a a uasjuttod fanaaon pbintE amTfCbat+eebnicalCapisqG ata a Di io do inl e n r h c e banameark a Copatad a EP4x 37+hox54xto424Y+Yrz UFP= 4*32 + o*5+2-4 * + 8* 1ot 7*2 TeF= o.65+O:DI *DI DT= 4*3= y2 618 1 o) = 661.2 n O S - T T . C
  • 16. References 1. Roger S. Pressman, Software Engineering a Practitioner Approach, 3rd Edition, TMH, 2005. 2. Rajib Mall, Fundamantal of Software Engineering, 3rd Edition,PHI Publication, 2007. 3. Deepak Jain, Software Engineering for Practitioners, Ist Edition, Oxford, 2012. 4. K K Agarwal and Yogesh Singh, Software Engineering, 3rd Edition,Oxford, 2012. ******************** 16