Chapter 23 - Product Metrics
Chapter 23 - Product Metrics
Product Metrics
Slide Set to accompany
Software Engineering: A Practitioner’s Approach, 7/e
by Roger S. Pressman
All copyright information MUST appear if these slides are posted on a website for student
use.
1
Why Measure Software?
• Determine quality of the current product or
process
• Predict qualities of a product/process
• Improve quality of a product/process
Metric Classification
• Products
– Explicit results of software development activities.
– Deliverables, documentation, by products
• Processes
– Activities related to production of software
• Resources
– Inputs into the software development activities
– hardware, knowledge, people
Types of Measures
• Direct Measures (internal attributes)
– Cost, effort, LOC, speed, memory
5
Function Point metric (FP)
• Function points are derived using an empirical
relationship based on countable (direct) measures of
software's information domain and assessments of
software complexity
• Information domain values are defined in the following
manner:
– number of external inputs (EIs)
– number of external outputs (EOs)
– number of external inquiries (EQs)
– number of internal logical files (ILFs)
– Number of external interface files (EIFs)
6
Function Points
Information Weighting factor
Domain Value Count simple average complex
Count total
7
Size Oriented Metrics
• Size of the software produced
• Lines Of Code (LOC)
• 1000 Lines Of Code KLOC
• Effort measured in person months
Errors/KLOC
Defects/KLOC
Cost/LOC
Documentation Pages/KLOC
• LOC is programmer & language dependent
LOC Metric
• Easy to use
• Easy to compute
• However:
– How to interpret ...
• Empty lines
• Comments
• Several statements on one line
• Language and programmer dependent
• Doesn't respect complexity and content
Halstead’s Complexity Measures
• Calculate:
– n1 - number of distinct operators
– n2 - number of distinct operands
– N1 - total number of operators
– N2 - total number of operands
• Program Length: N = N1 + N2
• Program Vocabulary: n = n1 + n2
• Volume: V = N log n
• Program effort: E=V/L
Example
if (k < 2)
{
if (k > 3)
x = x*k;
}
• Distinct operators: if ( ) { } > < = * ;
• Distinct operands: k 2 3 x
• n1 = 10
• n2 = 4
• N1 = 13
• N2 = 7
Measures of Software Quality
• Correctness
– Defects/KLOC
– Failures/hours of operation
• Maintainability
– Mean time to change
– Cost to correct
• Usability
– Training time, skill level necessary to use
– Subjective questionnaire or controlled experiment
Metrics for the Object Oriented
• Metrics specifically designed to address object
oriented software
• Class oriented metrics
• Direct measures
Weighted Methods per Class
(WMC)
• Fan-in for M = 2
Fan-out Example
Function A ( ) {
call function B( ) ;
call function C( ) ;
call function D( );
}
• Fan-out for A = 3
Metrics for Maintenance
• Software Maturity Index (SMI)
– Provides an indication of the stability of a software product based on
changes that occur for each release
• SMI = [MT - (Fa + Fc + Fd)]/MT
where
MT = #modules in the current release
Fa = #modules in the current release that have been added
Fc = #modules in the current release that have been changed
Fd = #modules from the preceding release that were deleted in
the current release
• As the SMI (i.e., the fraction) approaches 1.0, the software
product begins to stabilize
23