Metrics PDF
Metrics PDF
Metrics PDF
1
Metric Classification Product vs. Process
Products Process Metrics-
Insights of process paradigm, software engineering
Explicit results of software development tasks, work product, or milestones.
activities. Lead to long term process improvement.
Deliverables, documentation, by products
Processes Product Metrics-
Assesses the state of the project
Activities related to production of software
Track potential risks
Resources Uncover problem areas
Inputs into the software development activities Adjust workflow or tasks
Evaluate teams ability to control quality
hardware, knowledge, people
2
LOC Metrics Function Oriented Metrics
Easy to use Function Point Analysis [Albrecht 79, 83]
Easy to compute International Function Point Users Group
Can compute LOC of existing systems but (IFPUG)
cost and requirements traceability may be Indirect measure
lost Derived using empirical relationships
Language & programmer dependent based on countable (direct) measures of
the software system (domain and
requirements)
3
Complexity Adjustment Complexity Adjustment (cont)
Does the system require reliable backup and Are the master files updated on line?
recovery? Are the inputs, outputs, files, or inquiries
Are data communications required? complex?
Are there distributed processing functions? Is the internal processing complex?
Is performance critical? Is the code designed to be reusable?
Will the system run in an existing heavily utilized Are conversions and installations included in the
operational environment? design?
Does the system require on-line data entry? Is the system designed for multiple installations
Does the online data entry require the input in different organizations?
transaction to be built over multiple screens or Is the application designed to facilitate change
operations? and ease of use by the user?
4
Using FP Complexity Metrics
FP and LOC based metrics have been found to LOC - a function of complexity
be relatively accurate predictors of effort and
cost Language and programmer dependent
Need a baseline of historical information to use Halsteads Software Science (entropy
them properly measures)
Language dependent n1 - number of distinct operators
Productivity factors: People, problem, process,
product, and resources n2 - number of distinct operands
FP can not be reverse engineered from existing N1 - total number of operators
systems easily N2 - total number of operands
5
Program Complexity McCabes Complexity Measures
McCabes metrics are based on a control
Volume: V = N log2 n
Number of bits to provide a unique designator for each of the n
flow representation of the program.
items in the program vocabulary.
A program graph is used to depict control
Program effort: E=V/L flow.
L = V*/V Nodes represent processing tasks (one or
V* is the volume of most compact design implementation
This is a good measure of program understandability more code statements)
Edges represent control flow between
nodes
V(G) = E N + 2
If-then-else Until E is the number of flow graph edges
N is the number of nodes
V(G) = P + 1
P is the number of predicate nodes
6
Example Flow Graph
1
i = 0;
while (i<n-1) do 2
j = i + 1;
while (j<n) do 3
if A[i]<A[j] then
swap(A[i], A[j]); 7 4 5
end do;
i=i+1; 6
end do;
7
Meaning McClures Complexity Metric
V(G) is the number of (enclosed) Complexity = C + V
regions/areas of the planar graph C is the number of comparisons in a module
Number of regions increases with the V is the number of control variables
number of decision paths and loops. referenced in the module
A quantitative measure of testing difficulty
and an indication of ultimate reliability
Similar to McCabes but with regard to
Experimental data shows value of V(G)
control variables.
should be no more then 10. Testing is
very difficulty above this value.
8
Quality Model High level Design Metrics
Structural Complexity
product
Data Complexity
System Complexity
operation revision transition
Card & Glass 80
reliability efficiency usability maintainability testability portability reusability
9
Coupling Metrics for Coupling
Data and control flow
di input data parameters
ci input control parameters Mc = k/m, k=1
do output data parameters
co output control parameters
Global m = di + aci + do + bco + gd + cgc + w + r
gd global variables for data a, b, c, k can be adjusted based on actual
gc global variables for control data
Environmental
w fan in number of modules called
r fan out number modules that call module
Formulate
Cohesion difficult to measure Collect
Bieman 94, TSE 20(8) Analysis
Data slice from a program slice Interpretation
Feedback
10
Metrics for the Object Oriented Weighted Methods per Class
n
11
Coupling between Classes Response for a Class
CBO is the number of collaborations RFC is the number of methods that could
between two classes be called in response to a message to a
As collaboration increases reuse class
decreases Testing effort increases as RFC increases
CRC lists the number of collaborations
Classes, Responsibilities, and Collaborations
12
Example LCOM Explanation
Take class C with M1, M2, M3 LCOM is the number of empty
I1 = {a, b, c, d, e} intersections minus the number of non-
I2 = {a, b, e} empty intersections
I3 = {x, y, z} This is a notion of degree of similarity of
methods.
P = {(I1, I3), (I2, I3)}
If two methods use common instance
Q = {(I1, I2)} variables then they are similar
LCOM of zero is not maximally cohesive
Thus LCOM = 1 |P| = |Q| or |P| < |Q|
13
Number of Operations Added Specialization Index
NOA SI = [NOO * L] / Mtotal
14
Coupling Factor Polymorphism Factor
is _ client (C , C ) PF =
M i o (C i )
.
CF= i j i j
. [M ]
(TC TC ) ( C i DC (Ci )
)
2
i n
is_client(x,y) = 1 iff a relationship exists between Mn() is the number of new methods
the client class and the server class. 0 Mo() is the number of overriding methods
otherwise. DC() number of descendent classes of a base
class
(TC2-TC) is the total number of relationships
possible (Total Classes2 diagonal) The number of methods that redefines inherited
methods, divided by maximum number of
CF is [0,1] with 1 meaning high coupling possible distinct polymorphic situations
15
Inheritance
Number of root classes
16