Software Metrics When you can measure what you are speaking about, and can express it in numbers, you know something about it; but when you cannot measure it, when you cannot express it in numbers your knowleage is of a meagre and unsatisfactory kind: It may be the beginning of knowledge, but you have scarcely in your thoughts advanced to the stage of science Lord Kelvin a physicist 2. In truth, a good case could be made that if your knowleage is meagre and unsatisfactory, the last thing in the world you should do is make measurements, the chance is negligible that you will measure the right things accidentally George Miller, a psychologist
Software Metrics 1. 2. ✂✁☎✄☎✆✞✝☎✟☎✠☛✡✌☞☎✆☛✍☛✄☎☞✏✎✌✠☎✑✒✄✔✓✕✁☎☞✗✖✘✝☎✟☎✠☛☞☎✑✒✄☛✎✘✙✚✄☎☞✏✛✌✜✢✆✤✣✥☞✏✦☎✟☎✠✚✖★✧☎☞☎✆☎✩☛✡✌☞✏✆ ✄✤✪✌✙✚✑✒✄☎✎✌✎✞✜✫✖✤✜✢✆☛✆☎✠☎✍☛✦✏✄☎✑✒✎✌✧✌✝☎✟☎✠☛✛✌✆☎✟✗✓✬✎✌✟☎✍☛✄✗✖✢✁☎✜★✆✌✣✔☞☎✦☎✟✏✠✚✖✌✜✫✖★✭☎✦☎✠✗✖☎✓✮✁☎✄☎✆ ✝✏✟☎✠☛✡✌☞☎✆☎✆☎✟✗✖✌✍☛✄☎☞☎✎✌✠☎✑✒✄☛✜✯✖✢✧✚✓✮✁☎✄✏✆✰✝✏✟☎✠☛✡✌☞☎✆☎✆☎✟✚✖✤✄✌✪✌✙✚✑✒✄☎✎✌✎✞✜✯✖✌✜✢✆☛✆✏✠☎✍☛✦☎✄☎✑✒✎✌✧ ✝✏✟☎✠☎✑✚✛✤✆☎✟✚✓✮✱✢✄☎✩✤✣✚✄☛✜✢✎✞✟☎✲☎☞☛✍☛✄☎☞✤✣✚✑✒✄✳☞✏✆☎✩☛✠☎✆☎✎✌☞✚✖★✜✢✎✤✲✫☞☎✡✏✖✢✟☎✑✯✝☛✛✌✜★✆☎✩☎✴☛✵✶✖✤✍☛☞✌✝ ✦✏✄✥✖★✁☎✄☛✦☎✄✌✣✗✜✢✆☎✆✏✜✢✆✌✣✔✟☎✲✏✛✌✆☎✟✚✓✮✱✢✄✏✩✌✣✚✄☎✧☎✦✏✠✚✖✘✝☎✟☎✠☛✁☎☞✗✷✘✄☛✎✌✡✌☞☎✑✒✡✌✄☎✱✝☛✜✢✆✞✝☎✟☎✠☎✑ ✖★✁☎✟☎✠✤✣✚✁✚✖★✎✰☞✏✩✚✷✘☞☎✆☎✡✌✄✏✩✔✖✢✟✔✖★✁☎✄☛✎☎✖✢☞✌✣✗✄✳✟✏✲☎✎✌✡✌✜★✄☎✆☎✡✌✄✏✸ Lord Kelvin, a physicist ✵✯✆✔✖✢✑✒✠✚✖★✁☎✧☎☞✞✣✚✟✏✟☎✩☛✡✌☞☎✎✌✄☛✡✌✟☎✠✏✱✢✩☛✦☎✄☛✍☛☞☎✩☎✄✔✖★✁☎☞✚✖✌✜★✲✌✝☎✟☎✠✏✑✚✛✌✆☎✟✗✓✕✱★✄☎✩✌✣✚✄☛✜★✎ ✍☛✄✏☞✌✣✚✑✒✄☛☞☎✆☎✩☛✠☎✆☎✎✌☞✗✖✢✜★✎✌✲✫☞✏✡☎✖✢✟✏✑✫✝✏✧✚✖✢✁✏✄✳✱★☞☎✎☎✖✏✖✢✁☎✜★✆✌✣✔✜✢✆✔✖★✁☎✄✔✓✮✟☎✑✒✱✢✩✞✝☎✟☎✠☛✎✌✁☎✟✏✠☎✱✢✩ ✩✏✟✳✜★✎✞✍☛☞☎✛✌✄☛✍☛✄☎☞☎✎✌✠✏✑✶✄✏✍☛✄☎✆✚✖★✎✌✭✔✖✢✁☎✄☛✡✌✁✏☞☎✆☎✡✌✄☛✜✢✎✞✆☎✄✤✣✚✱✢✜✣✚✜★✦☎✱✢✄✔✖★✁☎☞✚✖✘✝✏✟☎✠✔✓✕✜★✱✢✱ ✍☛✄✏☞☎✎✌✠☎✑✒✄✔✖✢✁✏✄✳✑✒✜✣✚✁✚✖☎✖★✁☎✜★✆✌✣✚✎✞☞☎✡✌✡✌✜★✩☎✄☎✆✗✖✢☞☎✱★✱✹✝✏✸ George Miller, a psychologist ✺
Software metrics · Product vs. process Most metrics are indirect No way to measure property directly or Final product does not yet exist For predicting, need a model of relationship of predicted variable with other measurable variables Three assumptions(Kitchenham) 1. We can accurately measure some property of software or process 2. A relationship exists between what we can measure and what we want to know 3. This relationship is understood, has been validated, and can be expressed in terms of a formula or model Few metrics have been demonstrated to be predictable or related to product or process attributes
Software Metrics Product vs. process Most metrics are indirect: No way to measure property directly or Final product does not yet exist For predicting, need a model of relationship of predicted variable with other measurable variables. Three assumptions (Kitchenham) 1. We can accurately measure some property of software or process. 2. A relationship exists between what we can measure and what we want to know. 3. This relationship is understood, has been validated, and can be expressed in terms of a formula or model. Few metrics have been demonstrated to be predictable or related to product or process attributes. ✻
Software Metrics(2 Code Static Dynamic Programmer productivity Desig Testing · Maintainabil Management Cost Duration time Staffing
Software Metrics (2) Code Static Dynamic Programmer productivity Design Testing Maintainability Management Cost Duration, time Staffing . ✼
Code metrics Estimate number of bugs left in code From static analysis of code From dynamic execution Estimate future failure times: operational reliability
Code Metrics Estimate number of bugs left in code. From static analysis of code From dynamic execution Estimate future failure times: operational reliability ✽
Static Analysis of Code Halsteads software physics or software Science n1=no of distinct operators in program n2 =no of distinct operands in program N1= total number of operator occurrences N2= total number of operand occurrences Program Length: N=N1+ N2 Program volume: V=N log,(n1+ n2) represents the volume of information(in bits)necessary to specify a program Specification abstraction level: L=(2* n2)/(n1*N2) Program Effort: E=(n1+N2*(N1+ N2)*log,(n1+ n2))/(2*n2) (interpreted as number of mental discrimination required to implement the program
Static Analysis of Code Halstead’s Software Physics or Software Science n1 = no. of distinct operators in program n2 = no. of distinct operands in program N1 = total number of operator occurrences N2 = total number of operand occurrences Program Length: N = N1 + N2 Program volume: V = N log 2 (n1 + n2) (represents the volume of information (in bits) necessary to specify a program.) Specification abstraction level: L = (2 * n2) / (n1 * N2) Program Effort: E = (n1 + N2 * (N1 + N2) * log2 (n1 + n2)) / (2 * n2) (interpreted as number of mental discrimination required to implement the program.) ✾