Measurement - part 2 1 Software Measurement Measurement Theory.
-
Upload
blake-lawrence -
Category
Documents
-
view
249 -
download
0
Transcript of Measurement - part 2 1 Software Measurement Measurement Theory.
Measurement - part 2 1
Software Measurement
Measurement Theory
Measurement - part 2 2
Measurement Theory
circa 1900 - applied to physics 1940’s - applied to psychology, sociology 1990’s - applied to software measurement
Measurement - part 2 3
Representational TOM
empirical relation system– (C,R)
numerical relation system– (N,P)
M maps (C,R) to (N,P) representation condition
– x<y => M(x)<M(y)
Measurement - part 2 4
Empirical
A set of entities, E A set of relationships, R
– often “less than” or “less than or equal”– note that not everything has to be related
Measurement - part 2 5
Numerical
A set of entities– also called the “answer set”– usually numbers - natural numbers, integers or
reals A set of relations
– usually already exists– often “less than” or “less than or equal”
Measurement - part 2 6
The Mapping
The representation condition– M(x) rel M(y) if x rel y– x rel y iff M(x) rel M(y)
Both have been used by classical measurement theory authors
I prefer the first definition
Measurement - part 2 7
“BIG” example
We want to measure people as BIG– i.e. height and weight
Empirically, if two people are the same height, the heavier is bigger– if two people are the same weight, the taller is
bigger Answer set is real or tuple?
Measurement - part 2 8
Classic Example
McCabe’s Cyclomatic Number Empirical - Control Flow Graph Numerical (Answer Set) - integers mapping - E-N+2
Measurement - part 2 9
Empirical
How can we rank McCabe’s?
What is the relationship?
What is a partial order?
Measurement - part 2 10
Creating a New Theory
Why should a theory devised for physical phenomenon be useful for
software - an artificial phenomenon?
Measurement - part 2 11
Empirical Relations
One cludge that appears very often in the computer science literature is to define the empirical relation as that which makes the representation condition hold for the measure
The truth is that we do not have centuries of consensus on the empirical relationships
Measurement - part 2 12
Artificial
Software has been described as an artificial science because we control the objects. In fact, the objects are artifacts - made by humans
However, if there are constraints on these artifacts, it is usually in the operations that can change the artifacts
Measurement - part 2 13
Transformations
Consider the transformations that you can do to a syntactically correct program that maintains the correctness:– add a statement– add a condition– remove a statement
Measurement - part 2 14
MOM
Model - Order - Mapping the model is the abstraction the order is an ordering on the abstraction
– can be partial, can be constructive the mapping is from the model to the
answer set– must preserve the order (I.e. rep condition)
Measurement - part 2 15
MOM
Measurement - part 2 16
Triangle Problem
cin>>a>>b>>c;type=“scalene”;if (a==b||b==c||a==c) type=“isosceles”;if (a==b&&b==c) type=“equilateral”;if (a>=b+c||b>=a+c||c>=a+b) type=“not a triangle”;if (a<=0||b<=0||c<=0) type=“bad inputs”;cout<<type;
Measurement - part 2 17
Triangle CFG1,2,3a
3b
4a
4b
5a
5b6a
6b7
Measurement - part 2 18
Formal Spec
CFG is described by set of nodes {1,3b,4a,4b,5a,5b,6a,6b,7} and set of arcs {(1,3b),(1,4a),(3b,4a),(4a,4b),(4a,5a), (4b,5a), (5a,5b),(5a,6a),(5b,6a),(6a,6b), (6a,7),(6b,7)
Measurement - part 2 19
Partial Order
Originally, for all cfg x,y, x <=y if and only if all nodes and edges in x are also in y.
Thus adding an edge to x made a new cfg y such that x <= y but y may not be a cfg for a valid program
Constructive definition - x <= y if there is a set of transforms (additive) such that the transforms are applied to x produce y
Measurement - part 2 20
Representation Condition
Can prove that for all cfg’s x and y, if x<=y then m(x) <= m(y)
Note that this is not the iff rep condition. Since the partial orders on the abstractions are partial, if can only be one way
Measurement - part 2 21
Proof of monotonicity
Can show that no additive transform can decrease the cfg or the value of the mapping
Can show that additive transforms of adding if-then, if-then-else, while will always result in an increase of 1 in the value of the mapping