SE-UNIT-3-II-Software metrics, numerical and their solutions.pdf

RadheyShyam18 579 views 16 slides Feb 20, 2024
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

Software metrics


Slide Content

Software Engineering (KCS-601)
Unit-3 (Second Part): Software Metrics
Dr. Radhey Shyam
Professor
Department of Computer Science and Engineering
SRMCEM Lucknow
(Aliated 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 [email protected].
April 18, 2022

Soktwahe Moi
LAtuanr Meic
o a
eL ChaadTeietiswi
a guaru Cautalle
Cturan
m
uuadiible
tale Mtsics ane wpetat o
nan
acens nelmdin
Penomanee, lamm n w lomo M
pmdutli wit, a mam tha u Cea,
Meacun n
7Maio ahe an imotant Coen
ualtacsuramu
Manasemotdebus
iming e anomami
a valnalle tr bthdevlAare a
denelmot am lendars,
en a dieren setw MaT
O RLad sAtwaneMDit
eyelmdlic
Cala funlowPoinhand LoC
matrics, Cnebv

FP and Loc bas
elatinel
LOT
a g.nelia of Colo
Course Name: M. Tech HaltoA
Asae sei
C
A
aetaralt rdiclod wa
toun
Semester: 2nd
Logk N, t N
Paper Name: Object OrientedSoftware
Engineering(MTCS-203B) 7
Topic: Halstead's SoftwareScience.ocahulay7,f n
wlam N
Halstead's SoftwareScience
Halstead's SoftwareScience
Halstead's complexity measurement was developed to measurea programmodule'scomplexiny
directlyfrom sourcecode,with emphasis
on
computational complexity.
The Halstead's measuresare basedon four scalarnumberderiveddirectlyfrom a programs
source code:
n 1S numberof distinct operators.
n2 is numberofdistinct operands.
eurYantev
Ni is total number of/distinct operators.
N is totalnumberofdistinct operands
From thesenumbers,five measuresare derived:
Measure Symbol Formula
Program length
N N=NI +Na
Programvocabulary
N
n=nit n2
Volume V=N* (log2 n)
Difficulty
D
D (n1/2)*(N2/2)
Effort E E=D*V

iaistead'suses certain measures such as
programlength,programvocabulary, v
difficulty, and effort for the given algorithm. By this Halstead's is trying to show that une
programlengthcan be caleulated, volume of algorithm can be estimated. The above given table
showshowactuallythesemeasurecan be obtained.
The Halstead'smeasuresare applicableto operationalsystemand to developmentefortsonce
the code has been written.Thus usingHalstead's measurementexperimentalverificationcan be
performedin softwarescience.
Programlength:
The length of a programis total usage of operators and operandsin the program.
Length (N) = Ni +N2
Program vocabulary:
The Programvocabulary is the number of unique operators and operands used in the program.
Vocabulary(n)= ni t n2
Program Volume:
The ProgramVolumecan be definedas minimumnumberof bits neededto 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
reserveworlds,returns,default,
continue, break,
sizeofare 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 andindex are
considered as operands
and[ ]
is
considered
as
operator.
9. All hash directives can be ignored.
10. Commentsare not considered.
11. In Goto statement, goto
is considered as operator and
label as operand.
Example:
ObtainHalstead's lengthand
volume
measurefor following
C function.
)
(Ctinatas hengtE
Void swap (int a[ ], int i)
uelwmeN n
int temp;
Fr Comptalia
Halsarel's
me
bistineFeporators
) {Fi
ne efperards; K 2 3
= -N=)
Temp ali
ail ali+1];:
afi+1]= temp;
legtiN)
=
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
CaledaliHalt Emd nplu ma 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 9
3.11
= 5 *2.32 +9*2.19 =31.37
GrpeTands
eumemeasoralnd|aelunenEstimated
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 mu mos "k uneavy imdelouda
Pacte e Cole.'mai dy
uteyaluate
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
TR
na,
6 Cewwnaitd Comaemanb.
4)
Hene
Po e
mo. TdCa
ode,
(11 v(4)=No. agions
&. Copul
yelemue
Cerkae
us floi n
CL=
e- nt 2
= 8 10
CoR eee
e
VG)= lo -
8+2
umda
2+2
4
elce
(vC) 7.
1
V(G Monr aA
me lemfpla
(

Ea-l P
i0
wtlCicn-1)d
i+1:
wil(i4n) do
Ai) 4A(1)
Surp (ACi)AU
i+1
e d.
Computeeyelsnaiu abeuelns rapy
CLat v¢) o abe 9s .

UNCTION POINT
ystv la.
mlboms,ap2,
wobuts
olusaluen
mamumm
ond
munmun,
MLbucsa
ptouclsup
khimolio
uanslit
Th peg.2el. soblesnand
dlerelaflAhbrBclucl
MloLLLALL
outand populer4
luerimlly
blunguLLd
pund
)Euncluafa peuul
lo2einaleBge
otes_LoC)
Ladis
availakL_ te LlhmaLL
Thu
miluc
La&LLkeR
The
TLpuettc_by
ceuMlusA
MMANA=
SeLLAcLImLLlucluennlUn Ahe
all
/ melucis
dualokncdheasuan
WhullC
coinLusng
hl
Ma imsluuciera,luaps_nedat_communluny
th
cOd AMd
hindur/_lnsaKLA9mg/u
Aoc has tkellewas)sherlcennin8
OC Loc
alumleucal
ualue (e
oc
Jeblom
ehat
saM
May
wrdilyMay wdaly
dlfaluesmt
ithindudkcal
codin
STyle.0
dfaUnen
preisammusay wiÍAeAcOtel I.n
dhfewnl
wayllsFALg Om
seavW
paLeawm

Reutal Bowmce mklnuub
MnRAwhuak am athpp
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
COMMaleuAk plal llplmincdhd
LA MUal L
LLL9M CAde lhtll,Elc_am
LoC hew luue 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
LENLLy_
heha th_doc coundwll
Thsuweudd AhuA8a
LmallprRaMMA asglo2us8AuL_hr doCceuas
measulee
h
lal pul un
dllueml/deselghalus,_thy weula.
a
Code lusebldurle
b dis Vceunagm
Page 2-

wUuy
dllucull
nal o p Alumali Jod/U Che
accutal p.
Che buoblemn
A0Ccoulca
specAlca)
OMA
Cempuld
0nly
bcemJully fdevnLe
mama9.eLS
dusunhsotr.clla
amy hvelol,4
el CUMU-be/øm
aclurty
halsLlasiljd
6199.c8L
th ZoC 0nelile
hotlcor
em he
MAmaebenspiCluV
peml melbuic
Mluc
houlceminIS
umcEM.
Funche
boiint
maMy
m. gliuc LSuncids
late
19 70 'S
uNcZien
nta Aehulalpiy
ueposkd_by ALbuchM
h
isnportamt aduamlojA3 Lt
mcluen peun AMTLUc/ Au
lhalt
CaM
LLnatl hiiac walp
LeducZ
LLclLcalue
diuctlyam he Vpuebi
ncpiuo Lcaobihna
ABCLCiy
Page 3 6

A
dapundemt
Lu JumcluoLS gt h
Asetwantoduct
Supporlin
lanfe
.
aluslksLwolLd
S Lhama bsoclucl
Lialuste
ia ads some
lasle
Cdaumly
tvnlhQess no
whna
Lach
dala amd
Uan
Siommsd LO he coHespondm?
_eutpul
mclon
dala
PumdernemtMetuc
parammmlesus
No f
Ne
uspil/s
Na Na
nalliiusales
No: 1-
ntnlaces
FP
UFP * TCF
Umoduslaol
EumclueM
Pomls
Lechancal
Compleaiy
Facle
TCF 0 65 0:01 X DL
degLe
imlluhace
DbndentM14paranmelsuswtuch
A8gmid walue

Lath ocie )No
S49milnul
Imodlnla
Moduroti
OL N
psLl No nm
5L StMg Inlluim
4 Na Abuls
ach
data lum mpul by
2 No lpu
Lach_Ldala lem
eilput by hs p
SNo LAAQLLIHILL
No lduimcdintiuaclue quLrLLshch
caM
4No
A Lhal (l Aapluus a ueup AoLucally
uldltid
5-lo
h JAtindadMAIl lenchaWge
L malueAh Ahn &yilnns.
MAdL
Udolakogucal lls uinclucll(Aala such
phypicalils
Fals Snapl Aa2Cemslo
6
No InpuI
3
5
Outpub
1
3 6
10 15
Fl13
5
Wgnt Chart

DI
No awpuls
Dulpuls
S2
11
Lalomal(unlreacrs
91
Atuat
Sinple =21 7
Cowola
aFumeiowPoiT value
a
demainhraslenuco
NCo -UCe inau : 3 2
No u bab = to
Lo ue 'imqi Yi=24
NO laa
ales tales= 2
e nal
Assma Wat Compleriq asaton
aln Page6 Me

FPUEPx TCf then. FP
funelion loint UFP
v ugte
a
a uasjutto d fanaaon pbintE
amTfCbat+eebnical CapisqG
ata a Di io do
in lenr
hce 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
nOS-T T . C

References
1. Software Engineering a Practitioner Approach, 3
rd
Edition, TMH, 2005.
2. Fundamantal of Software Engineering, 3
rd
Edition,PHI Publication, 2007.
3. Software Engineering for Practitioners,I
st
Edition, Oxford, 2012.
4. Software Engineering, 3
rd
Edition,Oxford, 2012.
********************
16