Software Metrics
-
Upload
ehsan-hessami -
Category
Technology
-
view
981 -
download
0
Transcript of Software Metrics
Ehsan hessami
Islamic Azad University OF Qazvin
Software Metrics
Software measurement is the mapping of symbols to objects
What?
Software measurement is the mapping of symbols to objects
What?
quantify some attribute of the objects
Why!!!!!? !
Criteria
Criteria
A metric must allow different entities to be distinguished.
A metric must obey a representation condition
Criteria…
Each unit of the attribute must contribute an equivalent amount to the metric
Different entities can have the same attribute value
Many timesthe attribute of interest is not directly measurable .
An indirect measure involves a measure and a prediction formula
Example
density
mass volume
Software Measurement Theory
2 Kinds :
numerical relation system
empirical relation system
The empirical relation system
two parts:
A set of entities, E
A set of relationships, R
The numerical relation system
two parts:A set of entities, N
A set of relationships, P
EXP : Integers , Real
EXP : Less , Equal
MappingM, maps (E, R) to (N, P)
related in the empirical system
related in the numberical system
MappingM, maps (E, R) to (N, P)
related in the empirical system
related in the numberical system
x rel y if M(x) rel M(y)EXP :
EXP . Mapping
X height=< Y height and X weight =< Y weight
measure, BIG
MONOTONICITY
IF increase the value of attribute , the object Will not Reverse .
MONOTONICITY
IF increase the value of attribute , The object will not Reverse . Exp :
y = 5x - x 2X>0 And X<5
X>=5 And X<10
Increaes
DecreaseNot Monotonicity
y = X2
Monotonicity
MEASUREMENT SCALES
There are five different scale types :nominalordinal
intervalratio
absolute
NormalThis type basically assigns numbers or symbols without regard to any quantity
NormalThis type basically assigns numbers or symbols without regard to any quantity
EXP:
Ordinalthere is an implied ordering of the entities by the numbers assigned to the entity
Ordinalthere is an implied ordering of the entities by the numbers assigned to the entity
EXP:
Not Equal1
3 2
First – Second
Second - third
Intervalthe amount of the difference is constant
Intervalthe amount of the difference is constant
EXP: converting from a Celsius to a Fahrenheit
Formule : 9.5 x +32
Ratio
the amount of the difference is constant and Well Zero
absolute
The absolute is a counting scale measure
EXP:
Product Metrics
The most basic metric for size is the lines of code metric .
Product metrics are metrics that can be calculated from the document independent of how it was produced .
McCABE’S CYCLOMATIC NUMBER
introduced in 1976 .
Use the Gragh Theory : C = E – N + 2
C = Cyclomatic number .
N = number of Eodes .E = number of Edges .
McCABE’S CYCLOMATIC NUMBEREXP :
E = 11 N = 8 C = 11 – 8 + 2
C = 5
2 3 4 51
McCABE’S CYCLOMATIC NUMBER
Calculating the cyclomatic number from control flow graphs is time-consuming .
McCabe found a more directMethod of calculating his measure .
McCABE’S CYCLOMATIC NUMBER
IN source Code :
IF , For , While
Case or multiple Branch
1 decision
1 less decision
Restriction :
McCABE’S CYCLOMATIC NUMBER
Control flow graphs are required to have a distinct starting node and a distinct stopping node
C = D + 1D = Sum of Decisions
Formula :
Restriction … :
Example
E = 3D = 2
E = 2D = 1
E = 2D = 1
D = 4
Complexity C = 5
Threshold Value
If the Complexity is greater than 10, efforts should be made to reduce the value or to split the module
HALSTEAD’S SOFTWARE SCIENCE
He did his work in the late 1960s and 1970s.
He empirically looked for measures of intrinsic size
HALSTEAD’S SOFTWARE SCIENCE
variablesconstants
Operands
commasparenthesesarithmetic operatorsbrackets
Operator
Basic Measures—η1 and η2
η2 = Count of unique Operands Count of unique Operatorη1 =
η = η1 + η2 total count of unique tokensη =
Basic Measures—η1 and η2
Exp :z = 0;While x> 0 z = z + y ; x = x + 1;End –while ;Print(z) ;
Operator = ; > + - Print () While-endwhileOperand z x y 0 1
η1 =8 η2 = 5 η = 13
Length(N)
N2 = Count of OperandsCount of OperatorN1 =
N = N1 + N2
N = total count of tokens
LengthEXP :
z = 0;While x> 0 z = z + y ; x = x + 1;End –while ;Print(z) ;
Operators= 3; 5While 1> 1+ 1- 1Print 1() 1
OperandsZ 4X 3Y 20 21 1
N = N1 + N2 = 14+12 = 26
Estimate of the Length(est N)
est N = η1*log + η2*logη12 2
η2
Estimate of the Length(est N)
est N = η1*log + η2*log
Exp :η1=8 , η2=5
est N = 8*3 +5*2.32 = 35.6
η12 2
η2
Volume ( V )
V = N * Log 2(η1+ η2)
Volume = number of bits
Volume ( V )
V = N * Log 2(η1+ η2)
Volume = number of bits
Exp: N = 26 , η1=8 , η2=5
V = 26 * Log = 96.2213
Potential Volume, V*
V* = (2 + η2*)log2(2+ η2*)
Potential Volume = Min number of bits
η2* = The Minimal number of Operands
Implementation Level : L = V* / V
Other Parameter
Implementation Level : L = V* / V
Effort : E = V / L unit of Effors is emd
Other Parameter
Implementation Level : L = V* / V
Effort : E = V / L
Time: T = E / S
18 emd / sec
unit of Effors is emd
Other Parameter
HENRY–KAFURA INFORMATION FLOW
measure the intermodule complexity of source code .
In = into the moduleOut = out the module
i
i
Weight = weight the module
HK = Weight *(out * in )i i i i
i
HENRY–KAFURA INFORMATION FLOWExp : Weight = 1
HK = 1110