Week 06 Lecture 11&12: Product Metrics Waqas Ud Deen
Week 06 Lecture 11&12: Product Metrics Waqas Ud Deen
11&12
Product Metrics
Waqas Ud Deen
1
Software Cost Estimation
2
Important Concepts
• Measure :A quantitative indication of an attribute
• Measurement :Act of measure
• Metrics :A quantitative measure of the degree to possess
a given attribute
• Indicator :A metric or combination of metrics which provide
an insight
3
Why Measurement ?
5
Why do we Measure?
• To
characterize
• To evaluate
• To predict
• To improve
6
Role
• Analysis and Assessment
By Software
Managers
• Collection of measures
By Software Engineers
7
What is Metrics ?
• Metrics are a system of parameters or ways of quantitative and periodic
assessment of a process that is to be measured, along with the
procedures to carry out such measurement and the procedures for the
interpretation of the assessment in the light of previous or comparable
assessments. Metrics are usually specialized by the subject area, in which
case they are valid only within a certain domain and cannot be directly
benchmarked or interpreted outside it.
Retrieved from "http://en.wikipedia.org/wiki/Metrics"
• The metric system is the modern approach to weights and measures.
• Measures typically are quantitative in nature, conveyed in
numbers, dollars, percentages, etc
8
Contd!....
9
Software Measurements
11
Measurement Process Five Activities
• Formulation: The derivation of software measures and
metrics appropriate for the representation of the software
that is being considered.
• Collection: The mechanism used to accumulate data
required to derive the formulated metrics.
• Analysis: The computation of metrics and the application of
mathematical tools.
• Interpretation: The evaluation of metrics resulting in insight
into the quality of the representation.
• Feedback: Recommendations derived from the interpretation
of product metrics transmitted to the software team.
12
The Attributes of Effective S/W Metrics
• Processes
– Activities related to production of software
• Resources
– Inputs into the software development activities
– hardware, knowledge, people
Product vs. Process
• Process Metrics
– Insights of process paradigm, software engineering tasks,
work product, or milestones
– Lead to long term process improvement
• Product Metrics
– Assesses the state of the project
– Track potential risks
– Uncover problem areas
– Adjust workflow or tasks
– Evaluate teams ability to control quality
Types of Measures
• Direct Measures (internal attributes)
– Cost, effort, LOC, speed, memory
• Easy to compute
24
Types of SLOC
• There are two major types of SLOC measures:
physical SLOC (LOC) and logical SLOC (LLOC).
Example
• for (i = 0; i < 100; i += 1) print("hello"); /* How many
lines of code is this? */
• In this example we have:
• 1 Physical Lines of Code (LOC)
• 2 Logical Line of Code (LLOC) (for statement and printf
statement)
• 1 comment line
/* Now how many lines of code is this? */
for (i = 0; i < 100; i += 1)
{
printf("hello");
}
• 5 Physical Lines of Code (LOC): is placing braces work to be
estimated?
• 2 Logical Line of Code (LLOC): what about all the work
writing non-statement lines?
• 1 comment line: tools must account for all code and
comments regardless of comment placement.
Complexity
Metrics
• LOC - a function of complexity
• Language and programmer dependent
• Halstead’s Software Science
Halstead's complexity measures are based on counts of
operators and operands in code. This is highly correlated to
the number of lines of code, with the improvement that
more complicated lines will contribute more to the metric
than simple lines. Halstead's central observation on
program length is that the number of distinct, unique
operators and operands can be used to compute a number
that approximates N:
Halstead’s Metrics
– n1 - number of distinct operators
– n2 - number of distinct operands
– N1 - total number of operators
– N2 - total number of operands
Example
if (k < 2)
{
if (k > 3)
x = x*k;
}
• Distinct
operators: if
(){}><=*;
• Distinct
operands: k 2
3x
• n1 = 10
• n2 = 4
Advantages
• Easy to count
• It is an artifact of all software development projects
Disadvantages
• LOC measures are programming language
dependent
• Its use in estimation requires a level of detail that is
difficult to achieve early in the development
process
35