Вы находитесь на странице: 1из 12

The Uncertainty Principle in Software Engineering

Hadar Ziv Debra J. Richardson Rene Kl


osch
Information and Computer Science Department of Distributed Systems
University of California, Irvine Institute of Information Systems
Irvine, CA 92697-3425 Vienna University of Technology
USA Vienna, Austria
+1.714.824.4047 +43.1.58801
fziv,djrg@ics.uci.edu R.Kloesch@infosys.tuwien.ac.at

Abstract quality and developer productivity in the presence of


This paper makes two contributions to software engi- complexity. We contend that attempts to alleviate soft-
neering research. First, we observe that uncertainty ware complexity are often impeded by the uncertainty
permeates software development but is rarely captured permeating virtually every aspect of software develop-
explicitly in software models. We remedy this situation ment. In subsequent sections, we provide supporting
by presenting the Uncertainty Principle in Software En- evidence for our claim. First, examples of uncertainty
gineering (UPSE), which states that uncertainty is in- in select domains of software development are presented,
herent and inevitable in software development processes followed by a discussion of three common sources of un-
and products. We substantiate UPSE by providing ex- certainty in software engineering. We then present the
amples of uncertainty in select software engineering do- Uncertainty Principle in Software Engineering (UPSE),
mains. We present three common sources of uncertainty followed by more detailed expositions of uncertainty in
in software development, namely human participation, software testing, including test planning, test enact-
concurrency, and problem-domainuncertainties. We ex- ment, error tracing, and quality estimation. We de-
plore in detail uncertainty in software testing, includ- scribe a speci c technique for modeling and manage-
ing test planning, test enactment, error tracing, and ment of uncertainty, known as Bayesian belief networks
quality estimation. Second, we present a technique for or simply Bayesian nets. We demonstrate the use of
modeling uncertainty, called Bayesian belief networks, Bayesian nets for a simple network of software artifacts
and justify its applicability to software systems. We ap- and relations based on an elevator control system. We
ply the Bayesian approach to a simple network of soft- conclude with a discussion of issues and concerns in
ware artifacts based on an elevator control system. We uncertainty modeling, both speci cally using Bayesian
discuss results, implications and potential bene ts of nets as well as in general.
the Bayesian approach. The elevator system therefore We wish to note that uncertainty abounds in many as-
serves as an example of applying UPSE to a particular pects of software development, as well as in other engi-
software development situation. Finally we discuss ad- neering disciplines and in everyday situations (For un-
ditional aspects of modeling and managing uncertainty certainty in everyday situations, see, for example, [33],
in software engineering in general. pp. 460.). A detailed exposition of uncertainty in gen-
Keywords eral is therefore beyond the scope of this paper. We
Software principles, software testing, uncertainty mod- hope that UPSE nevertheless identi es an opportunity
eling, Bayesian networks for future investigations and provides a solid founda-
INTRODUCTION tion for broader discussions of uncertainty modeling in
Today's software engineer is expected to develop, main- software engineering. We encourage the reader to con-
tain and comprehend software systems of unprecedented sider occurrences and in uences of uncertainty in her
size and complexity. The complexity of software sys- own domains of interest and expertise.
tems and their development processes is known to be Uncertainty in Software Engineering Domains
intrinsic and essential [3]. Substantial e orts in soft- Here, we present four select domains of software engi-
ware engineering research attempt to improve software neering where uncertainty is evident. Later, we discuss
uncertainty in software testing in greater detail. For
each domain, we include questions that arise frequently
and indicate potential uncertainties. These questions
often require answers of degree as opposed to binary
yea or nay. Later, we show that these questions may be
addressed by means of probability values.
Uncertainty in requirements analysis Uncertainty in the problem domain
Software requirements elicitation and analysis typically A software system typically includes one or more mod-
include learning about the problem and problem do- els of the \real world" domain in which it operates. The
main, understanding the needs of potential users, and real world, however, is full of uncertainties, and there-
understanding the constraints on the solution. Analysis fore a system that models the real world inevitably re-
and speci cation of software requirements inevitably in- ects domain uncertainties. Domain uncertainties are
troduces uncertainties, including: Who will be the real often only implied or simply ignored in the system's do-
system users? What are users' needs and expectations? main model. This may lead to discrepancies between the
How well is the problem domain understood? How rig- real world and system assumptions and actions, which
orously, accurately and suciently are domain under- may in turn lead to risks and hazards. Also, in embed-
standing and user needs and expectations captured in ded systems, there are uncertainties with respect to ex-
the requirements speci cation document? ternal software, hardware, and mechanical components.
Uncertainty in the transition from system requirements Ignoring these uncertainties may be hazardous, possi-
to design and code bly even fatal 1. Uncertainty also exists in the natural
Software development typically requires the system to and physical sciences. According to Heisenberg's uncer-
be represented at multiple levels of abstraction, in- tainty principle, for instance, the presence of an observer
cluding, for example, requirements analysis models, de- may a ect scienti c observations such that absolute con-
sign models, and source code implementations. Tran- dence in observed results is not possible.
sitioning between di erent levels of abstraction, how- Uncertainty in the solution domain
ever smooth, often introduces uncertainties, including: Software systems constitute solutions to real world
How well does the design model correspond to the re- problems. Software solutions may introduce additional
quirements analysis model? How well does the imple- uncertainties above and beyond those attributed to the
mentation correspond to the design? How many of the problem domain. A known example of solution do-
speci ed requirements are indeed met? main uncertainty, discussed next, occurs in concurrent-
Uncertainty in software re-engineering program debugging. The key diculty in debugging
Software re-engineering includes reverse engineering of concurrent programs is due to race conditions, which
an existing system into higher-level architectural de- introduce uncertainty, because erroneous program be-
scriptions, followed by forward engineering of a revised havior observed in one execution may not be evident
system implementation. Thus, in addition to forward- in subsequent executions [24]. Moreover, any attempt
engineering uncertainties, software re-engineering also to \probe" the program for additional information, for
includes the following uncertainties: How well does example by instrumenting it, may adversely a ect the
available system documentation correspond to program probability of reproducing the erroneous behavior. This
source code? How accurately do models that were is often referred to as the \probe e ect" [12, 13] and is
reverse-engineered from program source code represent closely related to Heisenberg's uncertainty principle in
domain abstractions [14]? To what degree can original that by attempting to observe program behavior, the
system documentation be used in the reverse engineer- probes may inadvertently a ect the outcome of the ob-
ing process [35]? servation. Consequently, this uncertainty has been re-
ferred to as \Heisenbugs" [24].
Uncertainty in software reuse Human participation
Reuse of software components (for example, classes, pat- The active role played by humans in virtually every
terns and frameworks of object-oriented systems) intro- stage of the software lifecycle inevitably introduces un-
duces several uncertainties, including: How to specify certainty and unpredictability into software develop-
the interface of a reusable component completely and ment. That software development is still largely human-
suciently? What is one's con dence that an exist- intensive may seem trivial, yet surprisingly few methods
ing (i.e., available for reuse) component meets one's us- exist that explicitly model the inexact and uncertain na-
age needs? Given a reusable component, how can it ture of human involvement and its consequences for soft-
be tailored to existing project constraints and assump- ware processes and products. For example, rule-based
tions? Additional uncertainties have been identi ed in formalisms for software-process modeling, such as Mar-
the composition of reusable components [25]. vel/Oz [19] and Merlin [20], represent process steps and
Sources of Uncertainty in Software Engineering process decisions as rules, but do not accommodate ex-
Uncertainty occurs in software engineering for di erent plicit modeling of uncertainty in those rules.
reasons and stems from multiple sources. Three exam-
ple sources of uncertainty are described below. 1 Leveson and Turner [22] report on the Therac incidents, where
software uncertainties were deemed impossible and therefore were
not considered by the manufacturer of a medical radiation device.
Principles of Software Engineering THE UNCERTAINTY PRINCIPLE IN SOFT-
In 1968, the NATO conference held in Garmisch, Ger- WARE ENGINEERING
many [26] endorsed the claim that software construction Software development is a complex human enterprise
is similar to other engineering tasks and that software carried out in problem domains and under circum-
development must therefore \be practiced like an engi- stances that are often uncertain, vague, or otherwise
neering discipline." Engineers in classical engineering incomplete. Development must progress, however, in
disciplines are equipped with processes, methodologies, the presence of those uncertainties. The Uncertainty
standards, and tools that have been evolved, tested, and Principle in Software Engineering (UPSE) is therefore
proven successful. The use of standard procedures, ma- stated as follows:
terials, and building blocks limits the degrees of free-
dom and allows for engineering projects to proceed in Uncertainty is inherent and inevitable in soft-
predictable, controllable, and manageable fashion. ware development processes and products.
At the foundation of classical engineering disciplines one
often nds a small set of underlying principles and laws UPSE is, like other principles of software engineering,
of nature that govern the behavior of systems and guide a general and abstract statement about the nature of
their development. In the physical sciences, for instance, software development and is applicable throughout the
one nds Newton's laws of gravity, Einstein's theory of development lifecycle. The principle should still, how-
relativity, Kepler's laws of planetary motion, Heisen- ever, be applied judiciously and appropriately. The next
berg's uncertainty principle, and the laws of thermody- section describes key issues and concerns that need to
namics. Laws and principles of the physical world are be addressed when applying UPSE.
usually discovered, not invented, by observing physical Applying UPSE
systems. Such principles are con rmed and substanti- Software engineering processes and products include el-
ated by scienti c experiments that are controllable and ements of human participants (e.g., designers, testers),
repeatable and whose results are highly predictable. information (e.g., design diagrams, test results), and
In contrast, software systems appear unconstrained by tasks (e.g., \design an object-oriented system model,"
any laws or principles. It has long been recognized, or \execute regression test suite"). Uncertainty occurs
however, that software engineering would do well by a in most if not all of these elements. A software modeling
standard set of procedures, guidelines and principles. A activity would therefore do well to apply UPSE by ex-
recent book by Davis [8] documents 201 such principles. plicitly modeling one or more uncertainties, taking into
Ghezzi et al [15] identify seven principles at the heart of account the issues discussed below.
all software development activities. Brooks contributed What is the goal of the modeling activity?
two key principles to software engineering knowledge, A model of a software process or product is an abstrac-
namely \the mythical man-month" [2] and \no sliver tion that ignores some detail. Software models are de-
bullet" [3]. veloped for di erent reasons and to meet di erent goals
Software engineering principles should capture the na- and, consequently, may include di erent uncertainties.
ture and behavior of software systems and guide their If, for example, the goal of software modeling is to rep-
development. Such principles would help in restricting resent key system abstractions or artifact architecture,
degrees of freedom in software development and achiev- then uncertainties regarding conceptual and architec-
ing degrees of predictability and repeatability similar to tural decisions may need to be represented explicitly.
those of classical engineering disciplines. We observe Alternatively, if a software process is modeled to facili-
that in order for a principle of software engineering to tate project planning and prediction, then uncertainties
exhibit relevancy and applicability similar to other en- regarding schedule and budget estimates, progress mon-
gineering principles, it should be de ned and presented itoring, and project risks may be modeled explicitly.
generally and abstractly, be applicable and instantiable When is uncertainty modeling relevant?
in practice to speci c software development situations, Despite the generality of UPSE, uncertainty-modeling is
and be observed and substantiated repeatably and pre- not necessarily meaningful or equally applicable to all
dictably. aspects of a software-engineering e ort. Consider, for
One can con rm that software-engineering principles, example, a requirements-change scenario where a new
such as those recorded by Davis, Ghezzi, Brooks, and feature is requested for an existing software system. The
others, indeed meet the three \principle criteria" de ned challenging task of accommodating the new requirement
above. In this paper, we de ne and justify UPSE and often necessitates substantial changes to system archi-
contend that it also meets the three principle criteria tecture and implementation, and therefore leads to un-
above. We now proceed to de ne UPSE. certainties. On the other hand, a simpler, automatable
task such as creating a new release version or updating
system con guration information is less likely to intro- Test enactment includes test selection, test execution,
duce uncertainty 2 . and test result checking. Test enactment is inherently
What notation, formalism, or approach is used for mod- uncertain, since only exhaustive testing in an ideal en-
eling uncertainty? vironment guarantees absolute con dence in the testing
Notations and techniques for modeling uncertainty, process and its results. This ideal testing scenario is
vagueness, and fuzziness, have been studied extensively infeasible for all but the most trivial software systems.
in domains of arti cial intelligence [33, 18]. Di erent ap- Instead, multiple factors exist, discussed next, that in-
proaches for modeling uncertainty have been advocated troduce uncertainties to test enactment activities.
based on di erent mathematicalmodels as well as di er- Test selection is the activity of choosing a nite set of
ent assumptions about the sources and nature of uncer- elements (e.g., requirements, functions, paths, data) to
tainty. A detailed exposition of current approaches to be tested out of a typically in nite number of elements.
uncertainty modeling is beyond the scope of this paper. Test selection is often based on an adequacy or coverage
Instead, we focus on a particular uncertainty modeling criterion that is met by the elements selected for testing.
technique, called Bayesian belief networks. The fact that only a nite subset of elements is selected
UNCERTAINTY IN SOFTWARE TESTING inevitably introduces a degree of uncertainty regarding
Software testing has been described as \the search for whether all defects in the system can be detected. One
discrepancies between what the software can do versus can therefore associate a probability value with a testing
what the user or the computing environment wants it criterion that represens one's belief in its ability to de-
to do" [16]. We consider software testing broadly to tect defects. An example of assigning con dence values
include test planning, test enactment, error tracing, and to path selection criteria is given below.
quality estimation. We identify uncertainties associated Test execution involves actual execution of system code
with each activity below. on some input data. Test execution may still include
Test Planning uncertainties, however, as follows: the system under
We identify three aspects of test planning where un- test may be executing on a host environment that is
certainty is present: the artifacts under test, the test di erent from the target execution environment, which
activities planned, and the plans themselves. in turn introduces uncertainty. In cases where the tar-
get environment is simulated on the host environment,
Software systems under test include, among others, re- testing accuracy can only be as good as simulation accu-
quirements speci cations, design representations, source racy. Furthermore, observation may a ect testing accu-
code modules, and the relationships among them. These racy with respect to timing, synchronization, and other
software artifacts are produced by requirements analy- dynamic issues. Finally, test executions may not accu-
sis, architectural design, and coding processes, respec- rately re ect the operational pro les of real users or real
tively. Following UPSE, uncertainty permeates those usage scenarios.
development processes and, consequently, the resulting Test result checking is likely to be error-prone, inex-
software artifacts. Plans to test them, therefore, will act, and uncertain. Test result checking is a orded by
carry these uncertainties forward. means of a test oracle, that is used for validating test
Software testing, like other development activities, is results against stated speci cations. Test oracles can
human intensive and thus introduces uncertainties. be classi ed into ve categories [31], listed in decreasing
These uncertainties may a ect the development e ort order of uncertainty (or, alternatively, increasing order
and should therefore be accounted for in the test plan. of con dence), as follows: human oracles, input/output
In particular, many testing activities, such as test re- oracles, regression test suites, validation test suites, and
sult checking, are highly routine and repetitious and speci cation-based oracles. Speci cation-based oracles
thus are likely to be error-prone if done manually. This instill the highest con dence, but still include uncer-
again introduces uncertainties. tainty that stems from discrepancies between the speci -
Test planning activities are carried out by humans at cation and customer's informal needs and expectations.
an early stage of development, thereby introducing un- We have modeled uncertainties in test oracles for an
certainties into the resulting test plan. Also, test plans extended system test scenario, but space does not per-
are likely to re ect uncertainties that are, as described mit its inclusion in this paper. Instead, we provide two
above, inherent in software artifacts and activities. smaller and simpler examples of modeling uncertainty
Test Enactment in software testing. The rst example, described next,
is in the domain of path selection criteria.
2Note, however, that automatable operations that do not re- Example: Path Selection Testing Criteria
quire human intervention are not necessarily free of uncertainties. Here, we add a measure of uncertainty to a previous
result in comparison of data ow path selection testing How are con dence values determined?
criteria. In [5], the authors present a subsumption hi- Con dence values, such as shown in Table 1, are of-
erarchy that imposes a partial order on di erent data ten determined by consultation with domain experts.
ow path selection criteria with respect to their ability Other techniques exist, however, for establishing con -
to provide adequate coverage of a given program. The dence values, including: values computed using software
subsumption relationship may be recast in terms of un- reliability or cost-estimation models; values obtained
certainty or degree of con dence, as follows: if criterion from empirical, statistical, or historical data; or else val-
A subsumes criterion B, then one has more con dence in ues acquired dynamically during software-process exe-
the defect-detection ability of A than that of B 3 . Con- cution. Some techniques and their implications are dis-
dence in the defect-detection ability of a given testing cussed further in subsequent sections.
criterion may be quanti ed by means of a probability How are con dence values used?
\belief" value between 0 and 1. This is illustrated in Con dence values may be useful, for example, for choos-
Table 1, which shows a plausible assignment of proba- ing the most appropriate testing criterion given project
bilistic con dence values for a dozen path selection cri- requirements and constraints. A safety-critical system,
teria from [5]. Table 1 raises some important questions, for instance, may require that only testing criteria with
however, discussed next. con dence levels in the ultrahigh region be used. In con-
trast, a commercial software product may may weigh
Path Selection Criterion Con dence Value the cost and duration of testing against time-to-market
All-Paths :65 constraints. We propose that, in both cases, probabilis-
All-DU-Paths :59 tic measures of con dence, for example, in the defect-
Ordered Context Coverage+ :61 detection abilities of testing criteria, be employed in the
Context Coverage+ :55 decision-making process.
Reach Coverage+ :45 Quality Estimation
All-Uses :45 Software testing is instrumental in establishing quality
All-C-Uses/Some-P-Uses :33 and high assurance in software processes and products.
All-P-Uses/Some-C-Uses :33 A key concern of software testing is \When to stop test-
All-Defs :25 ing?", which is often answered by means of quality es-
All-P-Uses :2 timation. We consider reliability testing and reliability
All-Edges :15 growth modeling to be among the most mature tech-
All-Nodes :1 niques for software quality assessment [23] and therefore
focus on them below.
Table 1: Con dence Values for Data Flow Path Selec- Considerable work in software reliability modeling is
tion Criteria based on a probabilistic notion of uncertainty. A prob-
abilistic model of software behavior is needed since nei-
Why are con dence values relatively low? ther program testing nor formal proof of program cor-
Low con dence values imply that even a \strong" path rectness can guarantee complete con dence in the cor-
selection criterion does not incur high levels of con - rectness of a program [16]. Software reliability measures
dence. This is because path selection does not take into to what degree a software system behaves as expected,
account, for example, data value selection. Some de- thereby modeling system behavior as observed by its
fects are only revealed by particular data values, but users, as opposed to static or dynamic properties of the
not by others. Therefore, low con dence values re ect code itself. Examples of measures used in software re-
the criteria's inability to guarantee defect detection. liability include frequency of failure and mean time to
What are the constraints, if any, on the assignment of failure. Software reliability may therefore be de ned
con dence values? as the probability that software faults do not cause a
The only constraint on assigning con dence values is program failure during a speci ed exposure period in a
that if A subsumes B in the subsumption hierarchy speci ed use environment [16].
of [5], then A's con dence value should be equal to or Hamlet [17] and Littlewood [23] extend existing relia-
higher than B's. Thus, there are in nitely many pos- bility theory be de ning \software dependability" as a
sible assignments of con dence values that preserve the statistical measure of software quality. Hamlet incor-
partial subsumption order of path selection criteria. porates Blum's idea of self-checking/self-correcting pro-
3 As discussed in [5], even if A subsumes B , it is still uncertain grams [1] into reliability such that the dependability of
whether A is in fact better at detecting defects, since demonstrat- a program P at input X is de ned as the con dence
ing the latter would require that empirical data be collected to probability that P is correct (with respect to its speci-
substantiate the graph theoretic proofs of subsumption.
cation) at X. intelligence research to provide a framework for rea-
Software reliability models not only demonstrate that soning under uncertainty [29, 27]. Bayesian networks
uncertainty may be measured and represented explic- have been used extensively in a wide range of applica-
itly but they can also be used to estimate future soft- tions [18]. Speci cally, the Bayesian approach has been
ware quality. Prediction of future reliability assumes applied successfully to large text and hypertext search
that software systems are used with statistical regular- databases in the domain of information retrieval [11, 7]
ity. This assumption, however, introduces uncertainty, and to validation of ultrahigh dependability for safety-
since future users may exhibit vastly di erent usage pat- critical systems [23].
terns. We conclude that probabilistic measures of soft- Informally, a Bayesian network is a graphical represen-
ware reliability can be used to provide initial estimates tation of probability relationships among random vari-
of con dence levels in software artifacts and relations. ables. A Bayesian network is a Directed Acyclic Graph
This is discussed in more detail in subsequent sections. (DAG), where graph nodes represent variables with do-
Error Tracing mains of discrete, mutually exclusive values. In the
When a software failure is detected, the source of the following, we use \nodes" when discussing structural
error must be found. The error may have been intro- aspects of Bayesian networks and \variables" when dis-
duced at an early stage of development, such as require- cussing probabilities. Directed edges between nodes rep-
ments analysis or system design, or later during coding. resent causal in uence. Each edge has an associated ma-
E ective error tracing, also known as the \discovery trix of probabilities to indicate beliefs in how each value
task" [10], requires that software artifacts are interre- of the cause (i.e., parent) variable a ects the probability
lated among themselves as well as to informal customer of each value of the e ect (i.e., child) variable.
requirements. The structure of a Bayesian network is de ned for-
Software traceability is therefore the creation, manage- mally as a triplet (N; E; P), where N is a set of nodes,
ment, and maintenance of relations from one software E  N  N a set of edges, and P a set of probabilities.
entity to other entities [9]. Software development en- Each node in N is labeled by a random random variable
vironments, including, among others, Marvel/Oz [19], vi, where 1  i  jN j. Each variable vi takes on a value
Merlin [20], and Arcadia [21], support software trace- from a discrete domain and is assigned a vector of proba-
ability by means of tool integration, object management bilities, labeled Belief(vi ) or Bel(vi ). Each probability
systems, and hypertext capabilities. For a large net- in Bel(vi ) represents belief that vi will take on a partic-
work of software artifacts and relations, however, trace- ular value. D = (N; E) is a DAG such that a directed
ability is still hampered by the cognitive diculty of edge e =< si ; ti >2 E indicates causal in uence from
sifting through large volumes of interrelated informa- from source node si to target node ti. For each node
tion. Software engineers are likely to get disoriented in ti, the strengths of causal in uences from its parent si
large software spaces due to uncertainties encountered are quanti ed by a conditional probability distribution
during navigation, such as \Where am I?", \How did I p(tijsi ), speci ed in an m  n edge matrix, where m is
get here?", and \Where can I go next?" [36, 34]. This the number of discrete values possible for ti and n is the
diculty is akin to the hypertext-navigation problem number of values for si .
known as \lost in hyperspace" [28]. The structure of a Bayesian network is usually de-
We conclude that explicit modeling of uncertainty is termined by consultation with experts. Probabilities
relevant and applicable to many software engineering in edge matrices can either be estimated by experts
situations and may help ameliorate practical problems, or compiled from statistical studies. An important
such as e ective navigation in large software spaces. assumption of Bayesian networks is variable indepen-
dence: a variable is independent (in the probabilistic
MODELING UNCERTAINTY sense) of all other non-descendant variables in the net-
We suggest that uncertainties associated with one or work except its parents.
more properties of software artifacts be modeled and Bayesian updating occurs whenever new evidence ar-
maintained explicitly. A network of software artifacts, rives. Here, we follow Pearl's original updating algo-
annotated with uncertainty values, can then, for exam- rithm [29], based on a message passing model, where
ple, be navigated more e ectively by guiding the soft- probability vectors are sent as messages between net-
ware engineer to artifacts that are more likely to exhibit work nodes. Bayesian updating proceeds by repeatedly
a particular property. We now describe the Bayesian sending messages, both \up" the network from a child
approach to uncertainty modeling. node to its parent and \down" the network from a par-
Bayesian Belief Networks ent node to its child, until all nodes are visited and their
Bayesian belief networks have been used in arti cial belief values, if needed, revised. This updating scheme
supports distributed implementation, since each node able to re ect dynamic changes in a software system by
can execute in a separate execution thread and be up- means of Bayesian updating. Furthermore, one's beliefs
dated by way of message passing. in software artifacts are typically in uenced by many
Pearl's updating algorithm requires that two additional factors. This is easily accommodated in Bayesian net-
vectors, labeled  and , be used.  vectors are used to works since evidence from multiple sources can be com-
send messages up the network, from a child node to its bined to determine the probability that a variable has a
parent.  values are typically set to one initially 4 , be- certain value. Finally, we believe that by using Bayesian
fore any evidence is propagated, but are later revised to networks one can address real problems of software en-
re ect new evidence. When new evidence is observed, gineering, including, among others, e ective navigation
for example, if \test suite T detected a defect in code of large software spaces, deciding when to stop testing,
unit M," then the corresponding  vector is revised to and identifying bottlenecks and high-risk components.
(10 ) or (01 ) as appropriate. Revised  values are sent as a Our choice of Bayesian networks, however justi ed, does
message up to the revised node's parent and multiplied not imply that other uncertainty-modeling techniques
by the edge matrix. The resulting vector is multiplied should not be considered. Rather additional investi-
by the parent node's  vector to yield a new . This up- gation of other approaches is required in order to study
ward propagation repeats until the network's root node their possible uses and compare their relative merits ver-
is reached. Similarly, downward propagation proceeds sus the Bayesian approach.
by means of messages, indicated by  vectors, sent from THE ELEVATOR SYSTEM EXAMPLE
a parent node to its child, until belief values for all net- As part of a large e ort to demonstrate integration ca-
work nodes are updated. pabilities of the Arcadia research project [21], we have
Bayesian updating of an arbitrary network (i.e., where developed a complete software solution for an elevator
cycles may exist in the underlying undirected graph) is control system. The elevator system is a classic prob-
known to be NP{hard [6], but if the network is tree- lem that has been used to demonstrate software engi-
structured 5 , Pearl's updating algorithm is quadratic in neering techniques in general and speci cally in the area
the number of values per node and linear in the num- of formal speci cation languages [32, 31]. The elevator
ber of children per parent. For a more comprehensive system is required to control n elevators in a building
description of Pearl's updating algorithm, see [29, 27]. with m oors. The problem concerns the logic required
Why Bayesian Networks? to move elevators between oors according to speci ed
We identify compelling reasons for using Bayesian net- functional requirements as well as safety, liveness, and
works for modeling uncertainty in software engineering. fairness constraints.
First, it is a mechanism to apply UPSE in practice, Software artifacts in our elevator system solution in-
i.e., Bayesian networks provide a mathematically sound clude a functional decomposition of requirements, de-
technique for explicit modeling of uncertainties inher- veloped using REBUS; formal requirements speci ca-
ent in software development. Moreover, their graph tions, including model-based speci cations in Z and in-
structure matches that of software systems. Thus, it terval logic speci cations using both RTIL and the GIL
is possible to impose a Bayesian network on a software toolset; object-oriented design diagrams, using Software
system by associating belief values with artifacts and Through Pictures' OOSD/Ada notation; code modules
conditional probability matrices with relations. Note implemented in Ada; and test suites, test criteria, and
that the notion of Bayesian belief corresponds to our test oracles, developed using TAOS [30].
earlier notion of degree of con dence. In the following, Software artifacts in the elevator system are interrelated
we use \belief" speci cally to refer to a Bayesian value, by means of artifact relationships, as follows: Ada code
whereas \con dence" is used more generally to indicate units are related to OOSD design speci cation elements;
subjective assessment of a software entity. In addition, design speci cations are related to requirements speci-
since more than one belief value may be associated with cations; requirements speci cations are related to test
a single software entity, multiple Bayesian networks can suites and test oracles that are used to ensure that the
be imposed on a single software system. system meets speci ed requirements; test suites are re-
Also, a software development process is highly dynamic lated to code units that are to be tested against the re-
in that software artifacts, relations, and associated be- quirements; and test criteria, used to determine whether
liefs are modi ed frequently. Bayesian networks are the code is adequately tested, are related to code units
4 Unlike Belief and  vectors, values in the  vector do not need
and test suites.
to sum to one.
5 In this paper, we limit our discussion to tree-structured soft-
We applied the Bayesian approach to the elevator sys-
ware networks. Bayesian updating algorithms for general DAGs tem solution. Software artifacts and relations were as-
exist, however, and are polynomial in time and space. signed probability values that were determined by con-
sultation with a domain expert. Though we have as- tation with a domain expert.
signed belief values and carried out Bayesian updating Initial State of Bayesian Network
for the entire elevator system, space does not allow for We begin with design node D. Con dence in the va-
the complete example to be shown. Instead, for clar- lidity of design speci cations varies considerably among
ity and brevity, we demonstrate the Bayesian approach di erent projects, di erent design methods, and di er-
for a partial unit test scenario that is modeled by a ent designers. In the unit test scenario, D's prior belief
subnetwork of only four elevator-system artifacts. The value is determined to be :7. This is recorded in D's
complete elevator example can be found in [37]. belief vector, as follows:
The Unit Test Scenario    
In the unit test scenario, a software entity is considered Bel(D = valid)
Bel(D) = Bel(D = invalid) = :7 :3
valid if it is traceable to original customer requirements
and meets customer needs and expectations (cf. [15]).
Note that absolute con dence in an entity's validity is As shown in Figure 1, a  vector, used later for down-
hard to achieve in practice. Instead, we associate a ward propagation, is also associated with D. Since new
probabilistic belief value with the statement \this en- evidence is yet to be propagated, D's  values are ini-
tity is valid," and assign those belief values to system tially set to the same values as Bel(D). Similarly, since
entities accordingly. no propagation has occurred yet, D's  values are all
In the unit test scenario, design node D represents an set to 1.
OOSD design speci cation element, for example, Ele- A directed edge from D to M indicated that M imple-
vator Controller Interface Spec. A probability value is ments D. Conditional probabilities in the corresponding
associated with D, representing prior belief that D is edge matrix represent beliefs that M is valid (or invalid)
valid. Similarly, module M represents an Ada code given that D is valid (or invalid). These probabilities
unit, for example, Elevator Controller Package, and is are determined by a domain expert as follows: if D is
assigned a probability value representing prior belief valid, then M is also valid with :6 probability. The
that M is valid. Since M implements D, there exists probability that M is invalid is, or course, :4. If D is
a causal relationship between M and D, indicated by a invalid, however, then M is valid with only :1 probabil-
directed edge in the network of Figure 1. ity and invalid with :9 probability. These probabilities
In addition, test nodes T1 and T2 represent two test are recorded in the edge matrix between D and M, as
suites, corresponding to two di erent test selection cri- shown in Figure 1.
teria, for example, All{Edges and All{Uses. Test suites Next, we compute our belief that M is valid by way of
are executed against code units in the system's imple- downward propagation. This is accomplished by com-
mentation and may succeed or fail. Test suite execution puting a  vector for M by multiplying D's  vector
is successful when no defects are detected, i.e., actual (the downward message) by the transpose of the edge
test results match expected results. Expected results matrix between D and M. The resulting  values are
for test result checking are provided either manually or assigned to Bel(M) and indicate initial belief of 45% in
by a test oracle. Here, a code module is considered in- M's validity. This is shown below and in Figure 1.
valid if a single defect is detected 6, i.e., if execution of  T    
any related test suite fails, which, correspondingly, sets Bel(M) = :6 :4 :7 = :45
its belief value to zero. Note, however, that successful :1 :9 :3 :55
test suite execution does not set the corresponding mod-
ule's belief value to one, since it does not instill complete Test suite T1 represents All{Edges, a relatively weak
con dence. Rather, con dence that M is valid merely testing criterion in the subsumption hierarchy of [5]).
increases with each successful test suite execution. This Table 1 associates a con dence level of :15 with the
is con rmed by the results of Bayesian updating in the defect-detection ability of All{Edges. We therefore de-
unit test scenario, reported below. termine the following probabilities for the edge matrix
The software network of Figure 1 provides a computa- between M and T1: if M is invalid, then T1 succeeds
tional framework for updating beliefs in the validity of (i.e., executes successfully) with :85 probability. Cor-
entities. In particular, success or failure of test suite respondingly, T1 fails with :15 probability. If M is
execution constitutes new evidence that is then propa- valid, then T1 always succeeds. Similarly, test suite T2
gated throughout the network to revise previous beliefs. represents All{Uses, a stronger testing criterion. Ta-
The initial state of the network, described next, includes ble 1 associates a con dence level of :45 with the defect-
prior beliefs in network nodes, as determined by consul- detection ability of All{Uses. This again determines the
corresponding edge-matrix probabilities to be :45 and
6 Alternate de nitions of validity are discussed later. :55, respectively. The resulting edge matrices are shown
in Figure 1. Next, belief values for T1 and T2 are com- some state or possesses some quality or property. In the
puted, as before, by means of downward propagation.  unit test scenario, for example, the observed quality for
values for T1 and T2 are computed by multiplying edge- design and code nodes is validity, whereas a test for the
matrix probabilities by a  message from M. Figure 1 design node and code unit is quality, whereas a test suite
shows the resulting belief values for T1 and T2. can be in one of two states, \success" or \failure." In
Network State After Executing T1 general, however, software artifacts may possess many
Figure 2 illustrates the e ects on the network of suc- di erent qualities, for example, correctness, robustness,
cessful execution of test suite T1. Bayesian updating reliability, safety, maintainability, and eciency. They
proceeds by means of sending  and  messages up and can also be in one of many di erent states. This implies
down the network, as follows: T1's  vector is revised that multiple Bayesian models may be associated with a
to (10); T1 sends (10) as a  message to M, where it is single software network. It also implies that assignment
multiplied by the edge matrix; the resulting vector is of belief values to artifact qualities must be consistent
then multiplied by M's current  vector, yielding M's with causal relationships in the network. In the unit
new . Next, M's Belief vector is revised by multiply- test scenario, for example, test suites are used to test
ing the current Belief vector by the new , yielding a the validity of code units, and therefore the observed
revised belief value of :49 that M is valid. M then sends quality is validity.
a  message to its parent D, which is used to revise D's When does a belief value become zero?
 and Belief vectors, as before. The revised belief that The elevator example demonstrates that belief values
D is valid is :72. Finally, M also sends a  message to may be set to zero under certain conditions. A belief
T2, where the  values are identical to M's new belief value of zero may have signi cant implications for other
values. T2 then recomputes its own  and belief vectors. belief values because of Bayesian updating. Determin-
Network State After Executing T2 ing whether a belief value should be zero is therefore
Next we consider the e ects on the network of executing important as well as potentially dicult. This decision
the stronger test suite T2 (All-Uses). Whether T2 suc- is in uenced, for each belief value, by the quality of the
ceeds or fails, belief values in the network are updated associated entity.
by means of propagation and re-computation of  and Assume, for example, that a Bayesian value represents
 values. If T2 were to fail, a defect has been detected belief that a source code unit is \bug free" or otherwise
and M is recognized as invalid. Speci cally, T2's  vec- correct with respect to speci ed requirements. In this
tor is set to (01 ) upon failure, and, after multiplication case, the failure of a single test suite must cause the
by the edge matrix, updates M's  and belief vectors to belief value to be set to zero (as in the unit test scenario
also be (01 ). Additional upward propagation from M to above). It is also conceivable, however, that test oracles
D results in a decrease in our belief in the validity of D. used for test result checking are themselves suspect. In
But, if T2 succeeds, then M's belief value increases to this case, one has only limited con dence in the testing
96.5%, and our belief that D is valid increases to 97%. process itself, and, consequently, failed execution of a
DISCUSSION test suite does not imply a belief value of zero.
The application of a Bayesian or other probabilistic ap- Assume a di erent scenario where a complex software
proach to software systems raises some issues and con- system includes many modules and is developed under
cerns. Among those we discuss issues deemed most per- stringent schedule constraints. Here, it might be ac-
tinent to this paper (in no particular order). ceptable for code units to contain known defects given
How are belief values interpreted? certain project considerations, including, for example,
In most applications of Bayesian networks (cf. [18]), be- \How many defects were detected in the module?",
lief values are associated with observable phenomena, \What kind of defects were detected?", \How costly
described using binary True/False statements. When is defect elimination during development?", and \How
modeling everyday situations, for example, the prior be- costly would this defect be if it caused operational fail-
lief value of the statement \It is sunny" may be deter- ure?". In this case, uncertainty is modeled for a qual-
mined to be :9, while the belief value of the statement ity other than program correctness, say \acceptability."
\The dog is barking" may be :55 [4]. Each statement can Belief values for program acceptability should decrease
therefore be viewed as an observation on some entity's with each failed execution of a test suite, but do not nec-
state, quality or property. Thus, values in a Bayesian essarily become zero upon single failure. Belief should
network represent beliefs that an entity is in some state only become zero when, for example, a preset threshold
or possesses some quality or property. (e.g., maximum number of defects allowed) is exceeded.
Similarly, a single belief value associated with a single Where do belief values come from?
software artifact represents belief that the artifact is in To use Bayesian networks, one must specify prior belief
values for network nodes as well as conditional proba- cution is successful. Testing is guided and monitored by
bilities for causal in uences. Certain independence as- continuous update and comparison of con dence levels
sumptions hold, as mentioned earlier, among variables against prede ned thresholds. Testers are noti ed and
in a Bayesian network, implying that relatively few be- may take appropriate action whenever thresholds are
lief values need be speci ed for each node, since they exceeded. This approach may be especially useful in
depend exclusively on its parents' belief values [4]. The safety-critical systems, where con dence requirements
question still remains, however, how to obtain belief val- and constraints are often speci ed numerically.
ues initially, discussed next. Other software-engineering domains
Ideally, prior belief values are determined by collecting In this paper, we have focused on software testing un-
empirical, historical or statistical data. This is possible certainties, but we believe that uncertainty could and
in software projects that collect data on, for example, should also be modeled for other domains, including
program bottlenecks and defect rates. Empirical data software reuse and re-engineering, requirements analysis
may also be available for development tasks, including and speci cation, software design and coding.
requirements analysis, design, coding and testing. For Other software qualities
example, empirical data regarding coverage adequacy of In this paper, we have focused on validity, not correct-
di erent testing criteria may be used to revisit the belief ness, as a software quality for which belief values are rep-
values in Table 1. resented. We believe, however, that uncertainty should
The ideal case, however, is seldom feasible. Instead, be modeled explicitly for many other software qualities,
Bayesian belief values are usually elicited from a domain including correctness, reliability, fairness, safety, testa-
expert who subjectively assesses them. Domain experts bility, maintainability, and eciency. As mentioned ear-
include, for example, project managers, lead program- lier, qualities associated with entities must be consistent
mers, senior designers, test researchers for test-strategy with causal relationships such that the resulting network
e ectiveness, and so on. Note that domain experts are is meaningful.
used primarily to determine prior belief values; subse- Other uncertainty modeling techniques
quent changes to belief values in the network are caused In this paper, we have used Bayesian networks to model
by new evidence by way of Bayesian updating. uncertainty in software development. Viable alter-
CONCLUSIONS AND FUTURE WORK natives to the Bayesian approach exist, however, in-
The Uncertainty Principle in Software Engineering cluding Certainty{Factor approaches, Dempster{Shafer
(UPSE) states that uncertainty is inherent and in- approaches, fuzzy logic, and default and monotonic
evitable in software development processes and prod- logic [33]. Relative merits and pitfalls of these tech-
ucts. UPSE is a general and abstract statement about niques should be studied and evaluated against the
the nature of software development. To demonstrate Bayesian approach in the context of software engineer-
UPSE, we have chosen a probabilistic Bayesian ap- ing situations.
proach to uncertainty modeling and applied it to a sim- Modeling uncertainty in software process
ple software network based on an elevator system. The In this paper, we have demonstrated that uncertainty
Bayesian approach a ords dynamic updating of beliefs can be modeled for both process (i.e., testing strate-
during software development. We have discussed some gies) as well as product (i.e., artifact networks) aspects
concerns and implications of the Bayesian approach for of software development, with an emphasis on model-
software engineering situations. ing uncertainty in software products. With respect to
We believe that much more stands to be gained by ex- modeling uncertainty in software processes, we believe
plicit modeling of uncertainty in software engineering. that software-process modeling formalisms must be aug-
In this paper, we have merely posited UPSE and demon- mented to include uncertainty values; that an environ-
strated its applicability, using the Bayesian approach as ment for supporting de nition and execution of pro-
a point example. In the remaining paragraphs, we dis- cess models should include capabilities for representa-
cuss additional uses and future research directions for tion and interpretation of belief values and should allow
uncertainty modeling. for Bayesian updating of those values; and that Bayesian
Monitoring the testing process updating procedures must be carried out during process
An important question in software testing is \How much execution, such that belief values and con dence levels
testing is enough?". This question may be addressed by are continuously updated as new evidence arrives.
explicit modeling of uncertainty, if sucient testing is The provision and update of belief values may be greatly
de ned in terms of levels of con dence in select sys- enhanced in process frameworks that include process
tem entities, for example, its code modules. As testing measurement capabilities. Such capabilities constitute a
progresses, con dence levels increase as long as test exe- rich source of information regarding the current state of
various elements and support the collection of statistical [19] G. T. Heineman, G. E. Kaiser, N. S. Barghuoti, and I. Z.
and empirical data that may signi cantly improve the Ben-Shaul. Rule chaining in Marvel: dynamic binding of
accuracy of prior belief value estimation. parameters. IEEE Expert, 7(6):26{33, December 1992.
[20] G. Junkermann, B. Peuschel, W. Schafer, and S. Wolf.
We expect that by modeling software process uncertain- MERLIN: Supporting Cooperation in Software Development
ties, one may achieve a more realistic representation of Through a Knowledge-Based Environment, chapter 5, pages
103{129. Wiley & Sons, England, 1994.
the process, enable automated belief revision by means [21] R. Kadia. Issues encountered in building a exible software
of Bayesian updating, and support prediction and guid- development environment: Lessons learned from the Arca-
ance of future development activities. dia project. In Proceedings of ACM SIGSOFT '92: Fifth
Symposium on Software Development Environments, pages
REFERENCES 169{180, December 1992.
[1] M. Blum and H. Wasserman. Program result-checking: A [22] N. G. Leveson and C. S. Turner. An investigation of the
theory of testing meets a test of theory. In Proceedings of Therac-25 accidents. IEEE Computer, 26(7):18{41, July
the 35th Annual Symposium on Foundations of Computer 1993.
Science, Santa Fe, NM, 1994. IEEE Computer Science Press. [23] B. Littlewood and L. Strigini. Validation of ultrahigh de-
[2] F. P. Brooks. The Mythical Man-Month. Addison-Wesley, pendability for software-based systems. Communications of
Reading, MA, 1975. the ACM, 36(11), November 1993.
[3] F. P. Brooks. No silver bullet: Essence and accidents of [24] C. E. McDowell and D. P. Helmbold. Debugging concurrent
software engineering. IEEE Computer, 20(4):10{19, April programs. ACM Computing Surveys, 21(4):593{622, Decem-
1987. ber 1989.
[4] E. Charniak. Bayesian networks without tears. AI Magazine, [25] R. T. Mittermeir and L. G. Wur . Composing software from
pages 50{63, Winter 1991. partially tting components. In IPMU'96, pages 1121{1127,
Granada, Spain, July 1996.
[5] L. A. Clarke, A. Podgurski, D. J. Richardson, and S. J. Zeil. [26] P. Naur, B. Randell, and J. N. Buxton, editors. Software
A formal evaluationof data ow path selection criteria. IEEE Engineering: Concepts and Techniques: Proceedings of the
Transactions on Software Engineering, SE-15(11), Novem- NATO Conferences. Petrocelli-Charter, New York, New
ber 1989. York, 1976.
[6] G. Cooper. Computational complexity of probabilistic infer- [27] R. E. Neapolitan. Probabilistic reasoning in expert systems:
ence using bayesian belief networks (research note). Arti cial theory and algorithms. Wiley, New York, New York, 1990.
Intelligence, 42:393{405, 1990. [28] J. Nielsen. Multimedia and Hypertext : the Internet and
[7] B. W. Croft. Knowledge-based and statistical approaches to beyond. AP Professional, Boston, MA, 1995.
text retrieval. IEEE Expert, 8(2):8{12, April 1993. [29] J. Pearl. Probabilistic reasoning in intelligent systems: Net-
[8] A. M. Davis. 201 Principles of Software Development. Mc- works of plausible inference. Morgan Kaufmann Publishers,
Graw Hill, New York, New York, 1995. San Mateo, CA, 1988.
[9] A. M. Davis. Tracing: A simple necessity neglected. IEEE [30] D. J. Richardson. TAOS: Testing with analysis and ora-
Software, 12(5):6{7, September 1995. cle support. In Proceedings of the 1994 International Sym-
[10] P. T. Devanbu, R. J. Brachman, P. J. Selfridge, and B. W. posium on Software Testing and Analysis (ISSTA), pages
Ballard. LaSSIE: a knowledge-based software information 138{153, Seattle, August 1994. ACM Press.
system. Communications of the ACM, 34(5), May 1991. [31] D. J. Richardson, S. L. Aha, and T. O. O'Malley.
[11] M. E. Frisse. Searching for information in a hypertext medi- Speci cation-based test oracles for reactive systems. In
cal handbook. Communications of the ACM, 31(7):880{886, Proceedings of the Fourteenth International Conference on
July 1988. Software Engineering, pages 105{118, Melbourne, Australia,
May 1992.
[12] J. Gait. A debugger for concurrent programs. Software | [32] S. R. Schach. Classical and Object-Oriented Software Engi-
Practice & Experience, 15(6):539{554, June 1985. neering. Irwin, Chicago, Illinois, 1996.
[13] J. Gait. A probe e ect in concurrent programs. Software | [33] M. Ste k. Introduction to Knowledge Systems. Morgan
Practice & Experience, 16(3):225{233, March 1986. Kaufmann, San Francisco, CA, 1995.
[14] H. Gall, R. Klosch, and R. Mittermeir. Object-oriented [34] D. Steinberg and H. Ziv. Software Visualization and
re-architecturing. In 5th European Software Engineering Yosemite National Park. In Proceedings of the Twenty-
Conference (ESEC'95), pages 499{519, Barcelona, Spain, Fifth Annual Hawaii International Conference on System
September 1995. Sciences, January 1992.
[15] C. Ghezzi, M. Jazayeri, and D. Mandrioli. Fundamentals of [35] H. Ziv, R. Klosch, and D. J. Richardson. Software re-
Software Engineering. Prentice-Hall, Inc., Englewood Cli s, architecting in the presence of partial documentation. Tech-
New Jersey, 1991. nical Report UCI-TR-96-30, University of California, Irvine,
[16] A. L. Goel. Software reliability models: Assumptions, lim- August 1996.
itations, and applicability. IEEE Transactions on Software [36] H. Ziv and L. J. Osterweil. Research issues in the intersec-
Engineering, SE-11(12):1411{1423, 1985. tion of hypertextand software developmentenvironments. In
[17] D. Hamlet. Predicting dependability by testing. In Pro- R. N. Taylor and J. Coutaz, editors, Software Engineering
ceedings of the 1996 International Symposium on Software and Human-Computer Interaction, volume 896 of Lecture
Testing and Analysis (ISSTA), pages 84{91, San Diego, CA, Notes in Computer Science, pages 268{279. Springer-Verlag,
January 1996. ACM Press. Berlin Heidelberg, 1995.
[18] D. Heckerman, A. Mamdani, and M. P. Wellman. Real-world [37] H. Ziv, D. J. Richardson, and R. Klosch. The uncertainty
applications of bayesian networks. Communications of the principle in software engineering. Technical Report UCI-TR-
ACM, 38(3), March 1995. 96-33, University of California, Irvine, August 1996.
D (design
 node)

= :7
  :3  
M = 1 Belief = ::73
val. inv. 1
val. :6 :4  
D inv. :1 :9  = ::73
M (code module)
 T    
 = :1 ::94
:6 :7 = :45
:3 :55
T1     T2
suc.
 1 0 fail = 1 1 Belief = :45  suc. fail 
val. :55 val. 1 0
M inv. :85 :15     M inv. :55 :45
 = :55 :45  = :55 :45
T1 (All-Edges test suite) T2 (All-Uses test suite)
 T          
1
 = :85 :15 0 :45 = : 9175  = 1 0 T :45 = :7525
:55 :0825 :55 :45 :55 :2475
       
= 1 1 :9175
Belief = :0825 = 1 1 Belief = ::7525
2475

Figure 1: Initial Belief Network for Unit Test Scenario

D (design
 node)

= :7
  :3  
M = :94 Belief = ::72
val. inv. :865 28
val. :6 :4  
D inv. :1 :9  = :85 1
M (code module)
 T    
 = :1 ::94
:6 :72 = :49
:28 :51
T1     T2
 suc. fail   = :85 1 Belief = :51 :49  suc. fail 
val. 1
M inv. :85 :15 0 val.
M inv. :55 :450
1
   
= 0 1  = :51 :49
T1 (All-Edges test suite) T2 (All-Uses test suite)
 1 0 T  :45   :9175   1 0 T  :49   :7705 
 = :85 :15 :55 = :0825  = :55 :45 :51 = :2295
       
 = 10 Belief = 10  = 11 Belief = ::7705
2295

Figure 2: Revised Belief Network After Execution of T1

Вам также может понравиться