Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 33

Unit - V

Knowledge gained from software measures

cost

Testability & Maintainability

Functionality

Effectiveness

Quality

Problems relative to current activites

Basics of Software Measurement


Definitions Metric - a quantifiable characteristic of software Measurement - the process of mapping from real world attributes to a mathematical representation Model - a mathematical relationship between metrics e.g. between quality factors and available metrics Validity - Does the metric accurately measure what it purports to measure Prediction system - a set of metrics and a model that can be used to predict some attribute of a future entity.

What is Measurement
measurement

is the process by which numbers or symbols are assigned to attributes of entities in the real world in such a way as to describe them according to clearly defined unambiguous rules

Examples of Entities and Attributes

How do we measure?
What

do we mean by assigning values?

Describe the world Need roles on how to evaluate what is the longest, biggest etc. Models of the entities being measured Model must be specific in terms of describing phenomena we are studying

Direct and indirect measurement


Direct

measurement

Measurement which does not depend on the measurement of any other attribute.
Indirect

measurement

Measurement which involves the measurement of one or more other attributes.

Characteristics of software measurement


Object Measurement Ranging from products to processes and projects Purpose of Measurements : such as characterization, assessment, evaluation Source of Measurement : Software designers, software testers and software managers Measured Property : Cost of software, reliability, maintainability, size Context of Measurement : Where software artifacts are measured in different environments, which are specified in advance before applying some software measures

Productivity measures
Size-related

measures

Based on some output from the software process. This may be lines of delivered source code, object code instructions, etc.
Function-related

measures

Based on an estimate of the functionality of the delivered software. Function-points are the best known of this type of measure.

Halstead's Software Science


An

analytical technique to measure:

size, development effort, and development time.

Halstead's Software Science


Halstead

used primitive program parameters:


developed expressions for:
over all program length, potential minimum volume, actual volume, language level, effort, development time.

Halstead's Software Science


(CONT.)

For

some given program, let:

used in the program,

1 be the number of unique operators

used in the program, N1 be the total number of operators used in the program, N2 be the total number of operands used in the program.

2 be the number of unique operands

Halstead's Software Science


The

(CONT.)

terms operators and operands have intuitive meanings,


a precise definition of these terms is needed to avoid ambiguities. Unfortunately there is no general agreement among researchers
on

definition of operators and operands:

Operators
Some

general guidelines can be provided: All assignment, arithmetic, and logical operators are operators. A pair of parentheses,
as

well as a block begin --- block end pair, are considered as single operators. it is used as the target of a GOTO statement.

A label is considered to be an operator,


if

Operators
An if ... then ... else ... endif

and a while ... do construct are single operators. A sequence (statement termination) operator ';' is a single operator. function call

Function name is an operator, I/O parameters are considered as operands.

Halstead's Software Science


The

(CONT.)

set of operators and operands for the ANSI C language:() [] . , -> *


+ - ~ ! ++ -- * / % + << >> < > <= >= != == & ^ | && || = *= /= %= += -= <<= >>= &= ^= |= : ? { ; CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN and a function name in a function call

Halstead's Software Science


Operands

(CONT.)

are those variables and constants

which are being used with operators in expressions.

Length and Vocabulary


Length

of a program quantifies

total usage of all operators and operands in the program: Thus, length N=N1+N2.
Program

vocabulary:

number of unique operators and operands used in the program.


program vocabulary

= 1 + 2 .

Program Length:
The

length of a program:

total number of operators and operands used in the code depends on the choice of the operators and operands,
i.e.

for the same program, the length depends on the style of programming.
N

= n1log2n1 + n2log2n2

Program Volume:
N

No of mental comparisons required to write a program of length N Log2n expresses the no of attempts in a binary search applied to vocabulary of size n
the notion of program volume V is introduced:
V= N log2

Potential Minimum Volume:


Intuitively,

denotes

program volume V

minimum number of bits needed to encode the program.


To

represent

different identifiers,
bits ( is the

we need at least log2 program vocabulary)

Potential Minimum Volume:


The

V*:

potential minimum volume

volume of the most succinct program in which the program can be coded.

Potential Minimum Volume:


If

an algorithm operates on input/output data d1, d2,... dn,


the most succinct program is f(d1,d2, ...,dn); V* = (2 + n2*)log2(2+n2) for which

1 = 2, 2 =n

Therefore,

V*=(2+ 2) log2(2+ 2)

Program level :
The

program level L is given by L=V*/V. V is a volume of another implementation originating from the same requirements L is a measure of the level of abstraction:
languages can be ranked into levels that appear intuitively correct.

Effort and Time:


Effort

E=V/L, where

E is the number of mental discriminations required to write the program also the effort required to read and understand the program.

Example:

main() { int a,b,c,avg; scanf("%d %d %d",&a,&b,&c); avg=(a+b+c)/3; printf("avg= %d",avg); }

Example:
The

unique operators are: main, (), \{\}, int, scanf, \&, ",", ";", =, +, /, printf The unique operands are: a,b,c,\&a,\&b,\&c,a+b+c,avg,3,"\% d \%d \%d", "avg=\%d

Example
Therefore Estimated
N

(CONT.)

n1=12, n2=11 n=n1+n2=23

= n1log2n1 + n2log2n2

Length=(12*log12+11*log11)

=(12*3.58 + 11*3.45) =(43+38)=81


V= N log2 Volume=Length*log(23)=81*4.52=366

Summary
Halsteads

software science

analytical method. Lets us determine:


length volume effort time

You might also like