Software Module 4
Software Module 4
Software Module 4
Objectives
After studying this unit, you should be able to:
z Understand the concept of Software metrics
z Learn about the Classification of metrics
z Understand the Metric Analysis Process
6.1 Introduction
Software metrics deal with the measurement of the software product and process by
which it is developed. Several objectives of software metrics are discussed. Different
types of metrics such as size metrics, object oriented metrics, communication metrics
and requirements metrics are discussed in detail.
z Any line of program text excluding comment or blank line, regardless of the number
of statements or parts of statements on the line, is considered a Line of Code.
Notes
Token Count
In this metrics, a computer program is considered to be a collection of tokens, which
may be classified as either operators or operands. All software science metrics can be
defined in terms of these basic symbols. These symbols are called as token. The basic
measures are n1 = count of unique operators.
n2 = count of unique operands.
N1 = count of total occurrences of operators.
N2 = count of total occurrence of operands. In terms of the total tokens used, the
size of the program can be expressed as N = N1 + N2
Function Count
z The size of a large software product can be estimated in better way through a larger
unit called module. A module can be defined as segment of code which may be
compiled independently.
z For example, let a software product require n modules. It is generally agreed that
the size of module should be about 50-60 line of code. Therefore size estimate of
this Software product is about n x 60 line of code.
existing software estimation models use LOC or KLOC as a key input, and that a large
body of literature and data predicated on LOC already exists. On the other hand,
Notes opponents argue that LOC measures are programming language dependent, that they
penalize well-designed but shorter programs, that they cannot easily accommodate
nonprocedural languages, and that their use in estimation requires a level of detail that
may be difficult to achieve (i.e., the planner must estimate the LOC to be produced long
before analysis and design have been completed).
Function points are computed by completing the table shown in Figure 6.2. Five
information domain characteristics are determined and counts are provided in the
appropriate table location. Information domain values are defined in the following
manner:
z Number of user inputs: Each user input that provides distinct application-oriented
data to the software is counted. Inputs should be distinguished from inquiries, which
are counted separately.
z Number of user outputs: Each user output that provides application-oriented
information to the user is counted. In this context output refers to reports, screens,
error messages, etc. Individual data items within a report are not counted
separately.
z Number of user inquiries: An inquiry is defined as an on-line input that results in
the generation of some immediate software response in the form of an on-line
output. Each distinct inquiry is counted.
z Number of files: Each logical master file (i.e., a logical grouping of data that may
be one part of a large database or a separate file) is counted.
z Number of external interfaces: All machine readable interfaces (e.g., data files on
storage media) that are used to transmit information to another system are counted.
Once these data have been collected, a complexity value is associated with each
count. Organizations that use function point methods develop criteria for determining
whether a particular entry is simple, average, or complex. Nonetheless, the
determination of complexity is somewhat subjective.
To compute the feature point, information domain values are again counted and
weighted. In addition, the feature point metric counts new software characteristic
Notes algorithms. An algorithm is defined as “a bounded computational problem that is
included within a specific computer program”. Inverting a matrix, decoding a bit string,
or handling an interrupt are all examples of algorithms.
Another function point extension for real-time systems and engineered products has
been developed by Boeing. The Boeing approach integrates the data dimension of
software with the functional and control dimensions to provide a function-oriented
measure amenable to applications that emphasize function and control capabilities.
Called the 3D function point, characteristics of all three software dimensions are
“counted, quantified, and transformed” into a measure that provides an indication of the
functionality delivered by the software.
Counts of retained data (the internal program data structure; e.g., files) and external
data (inputs, outputs, inquiries, and external references) are used along with measures
of complexity to derive a data dimension count. The functional dimension is measured
by considering “the number of internal operations required to transform input to output
data”. For the purposes of 3D function point computation, a “transformation” is viewed
as a series of processing steps that are constrained by a set of semantic statements.
The control dimension is measured by counting the number of transitions between
states.
A state represents some externally observable mode of behavior, and a transition
occurs as a result of some event that causes the software or system to change its mode
of behavior (i.e., to change state). For example, a wireless phone contains software that
supports auto dial functions. To enter the auto-dial state from a resting state, the user
presses an Auto key on the keypad. This event causes an LCD display to prompt for a
code that will indicate the party to be called. Upon entry of the code and hitting the Dial
key (another event), the wireless phone software makes a transition to the dialing state.
When computing 3D function points, transitions are not assigned a complexity value.
To compute 3D function points, the following relationship is used:
Index = I + O + Q + F + E + T + R
* Rules marked with an asterisk were added into Project Analyzer v8.0. Previous versions did not take these
rules into account.
The minimum limit for cyclomatic complexity is 1. This happens with a procedure
having no decisions at all. There is no maximum value since a procedure can have any
number of decisions.
Notes:
z A Case branch can cover several alternative values or ranges, such as Case 1, 2, 5
To 10. As they introduce no additional branches to decide on, they do not increase
cyclomatic complexity either.
z Cyclomatic complexity does not consider if any decisions actually happen at run-
time. A conditional statement can be unconditional in reality. This happens with
constant decisions such as If True Then. This kind of an "unconditional condition"
counts as a regular decision in cyclomatic complexity, even when there is only one
path to take, really.
z Multiple exits do not increase complexity. A procedure with a single exit is as
complex as one with multiple exits.
z Exit statements (Exit Do, Exit Sub, Return, End, and similar) do not increase
cyclomatic complexity. They are not decisions, but jumps. Complexity-wise, exit
statements are similar to GoTo statements, with the target being either end-of-
structure or end-of-procedure.
z Yield statements do not increase cyclomatic complexity. Yield, new in VB2012, is
like a procedure call, but backwards, back to the caller procedure. Execution
potentially continues with the statement following Yield. If it doesn't, Yield is just a
special exit, which doesn't increase cyclomatic complexity either.
CC, CC2 or CC3 — which one to use? This is your decision. Pick up the one that
suits your use best. CC and CC2 are "original" metrics and probably more widely used
than CC3. The numeric values are, in increasing order: CC3 (lowest), CC (middle) and
CC2 (highest). In a sense, CC2 is the most pessimistic metric. All of them are heavily
correlated, so you can achieve good results with any of them.
The original, usual limit for a maximum acceptable value for cyclomatic complexity
is 10. Other values, such as 15 or 20, have also been suggested. Regardless of the
exact limit, if cyclomatic complexity exceeds 20, you should consider it alarming.
Procedures with a high cyclomatic complexity should be simplified or split into several
smaller procedures.
Cyclomatic complexity equals the minimum number of test cases you must execute
to cover every possible execution path through your procedure. This is important
information for testing. Carefully test procedures with the highest cyclomatic complexity
values.
As the complexity reaches high values, changes in the program are likely to
produce new errors.
of trouble reports written and resolved over time, and number of requirements changes
over time.
Notes
Indicators are used in conjunction with one another to provide a more complete
picture of project or organization behavior. For example, a progress indicator is related
to requirements and size indicators. All three indicators should be used and interpreted
together.
Measuring Quality
Although there are many measures of software quality, correctness, maintainability,
integrity, and usability provide useful indicators for the project team. Gilb suggests
definitions and measures for each.
z Correctness: A program must operate correctly or it provides little value to its
users. Correctness is the degree to which the software performs its required
function. The most common measure for correctness is defects per KLOC, where a
defect is defined as a verified lack of conformance to requirements. When
considering the overall quality of a software product, defects are those problems
reported by a user of the program after the program has been released for general
use. For quality assessment purposes, defects are counted over a standard period
of time, typically one year.
z Maintainability: Software maintenance accounts for more effort than any other
software engineering activity. Maintainability is the ease with which a program can
be corrected if an error is encountered, adapted if its environment changes, or
enhanced if the customer desires a change in requirements. There is no way to
measure maintainability directly; therefore, we must use indirect measures. A
simple time-oriented metric is mean-time-to change (MTTC), the time it takes to
analyze the change request, design an appropriate modification, implement the
change, test it, and distribute the change to all users. On average, programs that
are maintainable will have a lower MTTC (for equivalent types of changes) than
programs that are not maintainable.
z Integrity: Software integrity has become increasingly important in the age of
hackers and firewalls. This attribute measures a system's ability to withstand
attacks (both accidental and intentional) to its security. Attacks can be made on all
three components of software: programs, data, and documents.
To measure integrity, two additional attributes must be defined: threat and security.
Threat is the probability (which can be estimated or derived from empirical
quality assurance and control activities as they are applied throughout all process
framework activities.
Notes
When considered for a project as a whole, DRE is defined in the following manner:
DRE = E/(E + D)
where E is the number of errors found before delivery of the software to the end-
user and D is the number of defects found after delivery.
The ideal value for DRE is 1. That is, no defects are found in the software.
Realistically, D will be greater than 0, but the value of DRE can still approach 1. As E
increases (for a given value of D), the overall value of DRE begins to approach 1. In
fact, as E increases, it is likely that the final value of D will decrease (errors are filtered
out before they become defects). If used as a metric that provides an indicator of the
filtering ability of quality control and assurance activities, DRE encourages a software
project team to institute techniques for finding as many errors as possible before
delivery.
DRE can also be used within the project to assess a team’s ability to find errors
before they are passed to the next framework activity or software engineering task. For
example, the requirements analysis task produces an analysis model that can be
reviewed to find and correct errors. Those errors that are not found during the review of
the analysis model are passed on to the design task (where they may or may not be
found). When used in this context, we redefine DRE as
DREi = Ei/ (Ei + Ei+1)
where Ei is the number of errors found during software engineering activity i and
Ei+1 is the number of errors found during software engineering activity i+1 that are
traceable to errors that were not discovered in software engineering activity i.
A quality objective for a software team (or an individual software engineer) is to
achieve DREi that approaches 1. That is, errors should be filtered out before they are
passed on to the next activity.
Finally, system complexity is defined as the sum of structural and data complexity,
specified as
Notes
C(i) = S(i) + D(i)
As each of these complexity values increases, the overall architectural complexity
of the system also increases. This leads to a greater likelihood that integration and test-
ing effort will also increase.
An earlier high-level architectural design metric proposed by Henry and Kafura also
makes use the fan-in and fan-out. The authors define a complexity metric (applicable to
call and return architectures) of the form
where n is the number of nodes and a is the number of arcs. For the architecture
shown in Figure 6.3,
size = 17 + 18 = 35
depth = the longest path from the root (top) node to a leaf node. For the architecture
shown in Figure 6.3, depth = 4.
width = maximum number of nodes at any one level of the architecture. For the
architecture shown in Figure 6.3, width = 6.
arc-to-node ratio, r = a/n,
Class
A class is a template from which objects can be created. This set of objects share a
common structure and a common behavior manifested by the set of methods. Three
class metrics described here measure the complexity of a class using the class’s
methods, messages and cohesion.
Method
A method is an operation upon an object and is defined in the class declaration.
Message
A message is a request that an object makes of another object to perform an operation.
The operation executed as a result of receiving a message is called a method. The next
metric looks at methods and messages within a class.
Cohesion
Cohesion is the degree to which methods within a class are related to one another and
work together to provide well-bounded behavior. Effective object-oriented designs
maximize cohesion since it promotes encapsulation. The third class metrics investigates
cohesion.
Coupling
Coupling is a measure of the strength of association established by a connection
from one entity to another. Classes (objects) are coupled three ways:
When a message is passed between objects, the objects are said to be coupled.
Classes are coupled when methods declared in one class use methods or attributes
of the other classes.
Inheritance introduces significant tight coupling between superclasses and their
subclasses.
Since good object-oriented design requires a balance between coupling and
inheritance, coupling measures focus on non-inheritance coupling. The next object-
oriented metric measures coupling strength.
Inheritance
Another design abstraction in object-oriented systems is the use of inheritance.
Inheritance is a type of relationship among classes that enables programmers to reuse
previously defined objects including variables and operators. Inheritance decreases
complexity by reducing the number of operations and operators, but this abstraction of
objects can make maintenance and design difficult. The two metrics used to measure
the amount of inheritance are the depth and breadth of the inheritance hierarchy.
Notes The number of children is the number of immediate subclasses subordinate to a class in
the hierarchy. It is an indicator of the potential influence a class can have on the design
and on the system. The greater the number of children, the greater the likelihood of
improper abstraction of the parent and may be a case of misuse of subclassing. But the
greater the number of children, the greater the reusability since inheritance is a form of
reuse. If a class has a large number of children, it may require more testing of the
methods of that class, thus increase the testing time. NOC, therefore, primarily
evaluates Efficiency, Reusability, and Testability.
6.6 Summary
Size-oriented software metrics are derived by normalizing quality and/or productivity
measures by considering the size of the software that has been produced. Function-
oriented software metrics use a measure of the functionality delivered by the application
as a normalization value. A function point extension called feature points is a superset
of the function point measure that can be applied to systems and engineering software
applications. Cyclomatic complexity, also known as V(G) or the graph theoretic number,
is probably the most widely used complexity metric in software engineering. Cyclomatic
complexity comes in a couple of variations as to what exactly counts as a decision.
Software metrics are numerical data related to software development. Metrics strongly
support software project management activities. The object-oriented metrics measure
principle structures that, if improperly designed, negatively affect the design and code
quality attributes. Product and process entities have specific attributes. Attributes are
usually divided into internal and external attributes. The contrast between direct
measurement and indirect, or derived measurement, is between a (direct) metric
function whose domain is only one variable and a (derived) function whose domain is
an n-tuple
Objectives
After studying this unit, you should be able to:
z Define software reliability, software reliability models and error rates
z Explain the Rayleigh model
z Describe the Weibull model
7.1 Introduction
The concept of software quality is more complex than what common people tend to
believe. However, it is very popular both for common people and IT professionals. If we
look at the definition of quality in a dictionary, it is usual to find something like the
following: set of characteristics that allows us to rank things as better or worse than
other similar ones.
Different philosophers attempts to define software quality as a complex concept that
can be decomposed in more detailed characteristics to enable evaluation of quality
through the evaluation of more detailed characteristics that are supposed to be easy to
measure or assess.
Software Quality Engineering is a process that evaluates, assesses, and improves
the quality of software.
Software quality is often defined as "the degree to which software meets
requirements for reliability, maintainability, transportability, etc., as contrasted with
Amity Directorate of Distance and Online Education
134 Software Engineering
greater levels of performance are specified, the design quality of a product increases, if
the product is manufactured according to specifications.
Notes
Quality of conformance is the degree to which the design specifications are followed
during manufacturing. Again the greater the degree of conformance, the higher the level
of quality of conformance.
In software development quality of design encompasses requirements,
specifications, and the design of the system. Quality of conformance is an issue
focused primarily on implementation. If the implementation follows the design and the
resulting system meets its requirements and performance goals, conformance quality is
high Quality.
Quality Control
Variation control may be equated to quality control. But how do we achieve quality
control? Quality control is the series of inspections reviews, and tests used throughout
the development cycle to ensure that each work product meets the requirements placed
upon it, Quality control includes a feedback loop to the process that created the work
product. The combination of measurement and feedback allows us to tune the process
when the work products created fail to meet their specifications. This approach views
quality control as part of the manufacturing process.
Quality control activities may be fully automated, entirely manual or a combination
of automated tools and human interaction. A key concept of quality control is that all
work products have clearly defined and measurable specifications. To which we may
compare the outputs of each process. The feedback loop is essential to minimize the
defects produced.
Quality Assurance
Quality assurance consists of the auditing and reporting functions of management. The
goal of quality assurance is to provide management with the data necessary to be
informed about product quality, thereby gaining insight and confidence that product
quality is meeting its goals.
Of course, if the data provided through quality assurance identify problems, it is
management's responsibility to address the problems and apply the necessary
resources to resolve quality issues.
Cost of Quality
Cost of quality includes all costs incurred in the pursuit of quality or in performing quality
related activities. Cost of quality, to identify opportunities for reducing the cost of quality
and to provide a normalized basis of comparison.
Quality costs may be divided into costs associated with prevention, appraisal, and
failure. Prevention costs include:
z Quality planning
z Formal technical reviews
z Test equipment
z Training
Appraisal costs include activities to gain insight into product condition "first time
through" each process. Appraisal costs include:
z In-process and inter process inspection
z Equipment calibration and maintenance
z Testing
The intersection of this line with the horizontal axis indicates either the fault number
where the failure rate goes to zero, or the amount of time necessary to remove all the
Notes faults. When the x-axis is the elapsed time, then the area under the straight line (units
are time failure/time) represents the number of faults.
Thus, empirical data about how often the software fails during testing or observation
is used to estimate the current rate. Theoretical ideas will be used to refine the
predictions for longer periods of time.
( 2
Estimated Defect Density in Phase = E ⋅ e −B(P −1) − e −BP
2
)
Where E = Total no. of Defects
P = Phase Number
B = Defect Detection Efficiency
Defect Detection Efficiency can be calculated by using the following method:
No. of Defects Found in a Phase
Defect Detection Efficiency = × 100
Total Number of Defects in the Phase
Using the above formula the Rayleigh’s Curve can be plotted as given below:
Case 1: If the actual defects are less than the predicted defects, the quality of
reviews need to be examined.
Notes
Figure 7.2: Actual defects are less than the predicted defects
Case 2: If the actual defects are more than the predicted, the model and total
defects expected are to be readjusted dynamically.
The cumulative hazard function for the Weibull is the integral of the failure rate or
H(t)=(tα)γ.
Notes
In probability theory and statistics, the Weibull distribution / ve b l/ is a
continuous probability distribution. It is named after Waloddi Weibull, who described it in
detail in 1951, although it was first identified by Fréchet (1927) and first applied by
Rosin & Rammler (1933) to describe a particle size distribution.
A more general three-parameter form of the Weibull includes an additional waiting
timeparameter μ (sometimes called a shift or location parameter). The formulas for
the 3-parameter Weibull are easily obtained from the above formulas by replacing t by
(t−μ)wherever t appears. No failure can occur before μ hours, so the time scale starts
at μ, and not 0. If a shift parameter μ is known (based, perhaps, on the physics of the
failure mode), then all you have to do is subtract μ from all the observed failure times
and/or readout times and analyze the resulting shifted data with a two-parameter
Weibull.
Various texts and articles in the literature use a variety of different symbols for the
same Weibull parameters.
Example: The characteristic life is sometimes called c (ν = nu or η = eta) and the
shape parameter is also called m (or β = beta). To add to the confusion, some software
uses β as the characteristic life parameter and α as the shape parameter. Some authors
even parameterize the density function differently, using a scale parameter θ=αγ.
Special Case: When γ = 1, the Weibull reduces to the Exponential Model, with
α = 1/λ = themean time to fail (MTTF).
Depending on the value of the shape parameter γ, the Weibull model can
empirically fit a wide range of data histogram shapes. This is shown by the PDF
example curves below.
The Weibull is very flexible and also has theoretical justification in many
applications
Notes
If the data follow a Weibull distribution, the points should follow a straight line.
We can comput the PDF and CDF values for failure time T = 1000, using the
example Weibull distribution with γ = 1.5 and α = 5000. The PDF value is 0.000123 and
the CDF value is 0.08556.
Functions for computing Weibull PDF values, CDF values, and for producing
probability plots, are found in both Dataplot code and R code.
Terminology
z Measured Test Cycle: A project test activity or test life-cycle phase deemed
appropriate by the organization to measure.
Amity Directorate of Distance and Online Education
Software Reliability 143
z Found Defect: These defects are found during a measured test cycle. Found
defects are categorized by severity.
z Removed Defect: These defects are those removed during a measured test cycle.
Notes
Removed defects are categorized by severity..
Defect Classifications
Defects severity shall be established and defined such as the following:
z Severity 1 Defects: This represents a major, functional impacting defect, which
MUST BE resolved prior to approval of product.
z Severity 2 Defects: This represents a moderately impacting defect, which
SHOULD BE resolved prior to approval of product.
z Severity 3 Defects: This represents a minimal impacting defect, whose resolution
needs to be negotiated with impacted personnel.
Counting Rules
z Each found defect should be counted in the measured test cycle where it was
found.
z Each removed defect should be counted in the measured test cycle where it was
removed.
10 0%
90%
80%
70%
60%
DRE 1
50% DRE 2
DRE 3
40%
30%
20%
10%
0%
1 2 3 4 5 6 7 8 9 10
Measurement Period
Measurement Period
1 2 3 4 5 6 7 8 9 10
DRE1 5% 20% 25% 35% 50% 70% 84% 90% 95% 98%
DRE2 3% 10% 20% 25% 40% 65% 70% 80% 90% 95%
DRE3 19% 50% 80% 71% 80% 95% 83% 85% 90% 90%
The Levels
The adoption of CMMI includes more definition of process areas. Rather than a single
grade, an appraisal in CMMI evaluates performance in all the process areas. This
finergrained approach allows for more detailed assessment of the areas an organization
needs to improve. The levels in CMMI and CMM are approximately the same, although
some have been renamed. Meeting the goals at one level explicitly requires meeting all
goals at lower levels. In both models, maturity levels provide a way to predict the future
performance of organizations based on process discipline. Recent versions of CMMI
include a level 0, which is defined as Incomplete. Some authors have posited that
negative levels should be provided, to account for environments that are actively
counterproductive.
The key features of the maturity levels are briefly discussed next.
Maturity Level 1:
Initial In the beginning, everything is chaotic. SEI frequently uses the phrase “ad hoc” to
describe processes at this maturity level. The organization does not provide stability in
its processes. Success depends upon individual competence, motivation, and effort.
Level 1 organizations can produce good results, but they are frequently late and over
budget.
Notes Level 4 is about introducing precise measurements into the process. Maturity level 4
organizations use quantitative metrics, including statistics, to control key processes and
subprocesses. Numeric goals are established for quality and performance, and are
used in process management. Detailed measures of performance are collected,
analyzed, and archived for future reference. The critical distinction between level 3 and
level 4 organizations is predictable performance. Level 4 organizations control
performance with feedback based on quantitative information. When processes vary
outside the normative performance, the sources of performance degradation are
identified and corrective measures are applied.
7.8 Summary
A formal inspection is a formal, scheduled activity where a designer presents material
about a design and a selected group of peers evaluates the technical aspects of the
design. The moderator selects the team, conducts the inspection, and reports the
results. The reader is often not the producer of the product; however, the reader will
guide the team through the work product during the inspection meeting. The recorder
maintains the records of the inspection and accurately reports each defect. The
producer is the one who originally produced the product. His or her role is to answer
questions during the inspection. The producer is also responsible for correcting any
Notes problems identified in the inspection. He or she then reports the corrections to the
moderator. When the producer satisfies the entrance criteria, the inspection is
scheduled. The producer then conducts an overview. It acquaints the rest of the
inspection team with the product to be inspected. The inspection team members study
the product. The time spent in preparing is controlled based on the size of the product in
KLOC. The moderator supervises the inspection meeting.
Some approaches use a reader other than the producer to actually conduct the
inspection. The producer reviews the report and corrects the product. The moderator
reviews the report and the correction. If it satisfies the exit criteria, the inspection is
completed. If not, the moderator can either have the producer rework the product or
reinspection can be scheduled. A checklist is a list of items that should be checked
during the review. Sometimes the items are expressed as questions to be answered.
The error rate is the inverse of the time between errors. The error rate can be used as
an estimate of the probability of failure, F(1). Rayleigh’s defect prediction model is
useful in determining the number of defects that are likely to occur during execution of a
project in the early stages. Defect removal effectiveness is a very important aspect of
product quality. A good defect removal process promotes the release of products with
lower latent defects, generating high customer confidence.
z Recorder: The recorder maintains the records of the inspection and accurately
reports each defect.
Notes z Producer: The producer is the one who originally produced the product. His or her
role is to answer questions during the inspection.
z Rework: The producer reviews the report and corrects the product.
z Checklists: A checklist is a list of items that should be checked during the review.
Sometimes the items are expressed as questions to be answered.
z Error Rates: The error rate is the inverse of the time between errors (inter-error
time). The error rate can be used as an estimate of the probability of failure, F(1).