Upcoming SlideShare
×

# Software Metrics

980 views

Published on

Software Metrics

Ehsan hessami

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
980
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
25
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Software Metrics

1. 1. Software Metrics<br />Ehsan hessamiIslamic Azad University OF Qazvin<br />
2. 2. What ?<br />Software measurement is the mapping of symbols to objects<br />
3. 3. What ?<br />Software measurement is the mapping of symbols to objects<br />Why ?!!!!!!<br />quantify some attribute of <br />the objects<br />
4. 4. Criteria<br />
5. 5. Criteria<br />A metric must allow differententities<br />to be distinguished.<br />A metric must obey a representation<br />condition<br />
6. 6. Criteria…<br />Each unit of the attribute must contribute an equivalent amount to the metric<br />Different entities can have the<br />sameattributevalue<br />
7. 7. Many times<br />the attribute of interest is not<br />directly measurable . <br />An indirect measure involves a<br />measure and a prediction<br />formula<br />
8. 8. Example<br />density<br />mass<br />volume<br />
9. 9. Software Measurement Theory<br />2 Kinds :<br />numerical relation system<br />empirical relation system<br />
10. 10. The empirical relation system<br />two parts:<br />A set of entities, E<br />A set of relationships, R<br />
11. 11. The numerical relation system<br />two parts:<br />A set of entities, N<br />EXP : Integers , Real<br />A set of relationships, P<br />EXP : Less , Equal<br />
12. 12. Mapping<br />M, maps (E, R) to (N, P)<br />related in the empirical system<br />related in the numberical system<br />
13. 13. Mapping<br />M, maps (E, R) to (N, P)<br />related in the empirical system<br />related in the numberical system<br />EXP : <br />x rel y if M(x) rel M(y)<br />
14. 14. EXP . Mapping<br />measure, BIG<br />X height=< Y height and X weight =< Y weight<br />
15. 15. MONOTONICITY<br />IF increase the value of attribute , <br />the object Will not Reverse. <br />
16. 16. MONOTONICITY<br />IF increase the value of attribute , <br />The object will not Reverse. <br />Exp : <br />2<br />y = X<br />Monotonicity<br />X>0 And X<5<br />2<br />y = 5x - x<br />Increaes<br />X>=5 And X<10<br />Decrease<br />Not Monotonicity<br />
17. 17. MEASUREMENT SCALES<br />There are five different scale types :<br />nominal<br />ordinal<br />interval<br />ratio<br />absolute<br />
18. 18. Normal<br />This type basically assigns <br />numbers or symbols without <br />regard to any quantity<br />
19. 19. Normal<br />This type basically assigns <br />numbers or symbols without <br />regard to any quantity<br />EXP: <br />
20. 20. Ordinal<br />there is an implied ordering of <br />the entities by the numbers <br />assigned to the entity<br />
21. 21. Ordinal<br />there is an implied ordering of <br />the entities by the numbers <br />assigned to the entity<br />EXP: <br />First – Second<br />Not Equal<br />1<br />Second - third<br />2<br />3<br />
22. 22. Interval<br />the amount of the difference <br />is constant<br />
23. 23. Interval<br />the amount of the difference <br />is constant<br />EXP: <br />converting from a Celsius to <br />a Fahrenheit<br />Formule : <br />9.5 x +32<br />
24. 24. Ratio<br />the amount of the difference <br />is constant and Well Zero<br />
25. 25. absolute<br />The absolute is a counting scale measure<br />EXP: <br />
26. 26. Product Metrics<br />Product metrics are metrics that<br />can be calculated from the<br /> document independent of how <br /> it was produced . <br />The most basic metric for size is <br />thelinesof code metric .<br />
27. 27. McCABE’S CYCLOMATIC NUMBER<br />introduced in 1976 . <br />Use the Gragh Theory : <br />C = E – N + 2<br />C = Cyclomatic number .<br />E = number of Edges .<br />N = number of Eodes .<br />
28. 28. McCABE’S CYCLOMATIC NUMBER<br />EXP : <br />5<br />1<br />4<br />3<br />2<br />E = 11 <br />N = 8<br />C = 11 – 8 + 2 <br />C = 5<br />
29. 29. McCABE’S CYCLOMATIC NUMBER<br />Calculating the cyclomatic number from control flow graphs is time-consuming . <br />McCabe found a more direct<br />Method of calculating his measure .<br />
30. 30. McCABE’S CYCLOMATIC NUMBER<br />Restriction : <br />IN source Code : <br />1 decision <br />IF , For , While <br />Case or multiple Branch <br />1 less decision <br />
31. 31. McCABE’S CYCLOMATIC NUMBER<br />Restriction … : <br />Control flow graphs are required to have a distinct starting node and a distinct stoppingnode<br />Formula : <br />C = D + 1<br />D = Sum of Decisions<br />
32. 32. Example<br />E = 2<br />D = 1<br />E = 2<br />D = 1<br />E = 3<br />D = 2<br />D = 4 <br />C = 5<br />Complexity<br />
33. 33. Threshold Value<br />If the Complexity is greater than 10<br />, efforts should be made to reduce the value or to split the module<br />
34. 34. HALSTEAD’S SOFTWARE SCIENCE<br />He did his work in the late <br />1960s and 1970s.<br />He empirically looked for measures<br />of intrinsic size<br />
35. 35. HALSTEAD’S SOFTWARE SCIENCE<br />variables<br />Operands<br />constants<br />commas<br />parentheses<br />Operator<br />arithmetic operators<br />brackets<br />
36. 36. Basic Measures—η1 and η2<br />η = η1 + η2 <br />η =<br />total count of unique tokens<br />Count of unique Operator<br />η1 =<br />Count of unique Operands <br />η2 =<br />
37. 37. Basic Measures—η1 and η2<br />Exp :<br />z = 0;<br />While x> 0<br /> z = z + y ;<br /> x = x + 1;<br />End –while ;<br />Print(z) ;<br />Operator <br />= ; > + - Print () While-endwhile<br />Operand <br />z x y 0 1<br />η1 =8 η2 = 5 η = 13<br />
38. 38. Length(N)<br />N = N1 + N2 <br />N =<br />total count of tokens<br />Count of Operator<br />N1 =<br />Count of Operands<br />N2 =<br />
39. 39. Length<br />EXP : <br />Operators<br />= 3<br />; 5<br />While 1<br />> 1<br />+ 1<br />- 1<br />Print 1<br />() 1<br />Operands<br />Z 4<br />X 3<br />Y 2<br />0 2<br />1 1<br />z = 0;<br />While x> 0<br /> z = z + y ;<br /> x = x + 1;<br />End –while ;<br />Print(z) ;<br />N = N1 + N2 = 14+12 = 26<br />
40. 40. Estimate of the Length(est N)<br />η1<br />η2<br />est N = η1*log + η2*log<br />2<br />2<br />
41. 41. Estimate of the Length(est N)<br />η1<br />η2<br />est N = η1*log + η2*log<br />2<br />2<br />Exp :<br />η1=8 , η2=5<br />est N = 8*3 +5*2.32 = 35.6 <br />
42. 42. Volume ( V )<br />Volume = number of bits<br />(η1+ η2)<br />V = N * Log<br />2<br />
43. 43. Volume ( V )<br />Volume = number of bits<br />(η1+ η2)<br />V = N * Log<br />2<br />Exp: <br />N = 26 , η1=8 , η2=5<br />13<br />V = 26 * Log = 96.2<br />2<br />
44. 44. Potential Volume, V*<br />Potential Volume = Min number of bits<br />V* = (2 + η2*)log<br />(2+ η2*)<br />2<br />η2* = The Minimal number of Operands<br />
45. 45. Other Parameter<br />Implementation Level : <br />L = V* / V<br />
46. 46. Other Parameter<br />Implementation Level : <br />L = V* / V<br />Effort : <br />E = V / L<br /> unit of Effors is emd<br />
47. 47. Other Parameter<br />Implementation Level : <br />L = V* / V<br />Effort : <br />E = V / L<br /> unit of Effors is emd<br />Time :<br />T = E / S<br />18 emd / sec<br />
48. 48. HENRY–KAFURA INFORMATION FLOW<br />measure the intermodule complexity of source code . <br />HK = Weight *(out * in )<br />i<br />i<br />i<br />i<br />In = into the module<br />i<br />Out = out the module <br />i<br />Weight = weight the module <br />i<br />
49. 49. HENRY–KAFURA INFORMATION FLOW<br />Exp : <br />Weight = 1 <br />HK = 1110<br />