Title: C0 Testing
1C0 Testing
- Instrumented code
- Output files (processed)
- Description of code not covered and why
2SRC Comments final doc
- Comments are important and will be graded in the
final documentation grading - This will be subjective
- Guidelines
- Every class/function should have a description of
purpose, internal data, inputs, outputs, author - Every section should have brief description of
purpose and algorithm (if not obvious) - Points will be deducted for useless comments
3Software Measurement
- quantifying software and
- software development
4Software Measures
- The purpose of software measures is to quantify
characteristics of programs. - Lord Kelvin is credited with claiming that a
subject is not a science unless you can measure
it. - Unless we can measure characteristics of
software, it will be very hard to develop a sound
science of software engineering.
5Measurement
- 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 rules
6Measurement Theory
- circa 1900 - applied to physics
- 1940s - applied to psychology, sociology
- 1990s - applied to software measurement
7Representational TOM
- empirical relation system
- (C,R)
- numerical relation system
- (N,P)
- M maps (C,R) to (N,P)
- representation condition
- xlty iff M(x)ltM(y)
8The 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 - Fenton prefers the second definition
9Scales
- nominal
- ordinal
- interval
- ratio
- absolute
10McCabe's Complexity Measure
- also called the Cyclomatic Number
- introduced 1976
- one of the two or three most commonly used
measures - premise - complexity is related to control flow
of the program
11Graph Theory
- the cyclomatic number
- minimal basis for describing any path in the
graph - not assumed to be complexity in graph theory
12Cyclomatic Number - arcs and nodes
- C e - n 2p
- where
- e number of edges,
- n number of nodes,
- p number of strongly connected components
TTYP1 what is e,n for triangle CFG? Assume
p1, what is cyclomatic number?
13CFG for triangle problem
14Euler (1707-1783)
- for planar graphs
- 2 n - e r
- where r number of regions, e number of edges,
and n number of nodes - 2 n - e r r e - n 2
- Therefore, the number of regions on a planar
graph equals the cyclomatic number
15Cyclomatic Number - regions
TTYP2 label the regions on the triangle CFG
16Cyclomatic Number - decisions
- C Pi 1
- where Pi is the number of decisions
TTYP3 label the decisions on the triangle CFG
17Threshold
- McCabe analyzed a large project and discovered
that for modules with complexity over 10, the
modules had histories of errors and difficulties
in maintenance
18Calculate McCabes cyclomatic
cin gtgt a gtgt b gtgt c if (a gt b) cout ltlt
hello if (c lt a)cout ltlt part 1 if ( c gt
b)cout ltlt part 2 else cout ltlt
part 3 elseif (clta)coutltltpart
4 cout ltlt exiting
TTYP4 draw the CFG and count e,n calculate
cyclomatic , label the regions and decisions
19Summary
McCabes cyclomatic number is not the
ultimate answer for complexity. It is a good
general indicator of relative size.
20Rest of Semester
- No more PLQs
- 11/28, 11/30, 12/5
- Security Presentations
- 12/7
- Review for 543 final
- Final Doc due Friday Dec 8th, 5pm
- Monday, Dec 11th 543 final 200-350