This document discusses adapting principles of software engineering design to the design and analysis of domain descriptions for reasoning about actions. Specifically, it explores how the informal concepts of cohesion and coupling from software engineering can provide criteria for evaluating domain description modules. Cohesion measures how related elements are within a module, while coupling measures interdependence between modules - both aim to minimize interactions and dependencies between modules. The document proposes organizing a domain description into modules for effects, non-effects, executabilities, inexecutabilities, and state constraints based on these software engineering principles.
Connector Corner: Automate dynamic content and events by pushing a button
Cohesion, Coupling and the Meta-theory of Actions
1. Cohesion, coupling and the meta-theory of actions
Andreas Herzig and Ivan Varzinczak
IRIT – Universit´ Paul Sabatier
e
118 route de Narbonne – 31062 Toulouse Cedex 04 France
¡
e-mail: herzig,ivan @irit.fr ¢
Abstract With this in mind, one can see the specification of domain
descriptions as a task similar to project development in soft-
In this work we recast some design principles com- ware engineering: Item 4 above is what has been called elab-
monly used in software engineering and adapt them oration tolerance [McCarthy, 1988]. In this way a represen-
to the design and analysis of domain descriptions tation is elaboration tolerant to the extent that the effort re-
in reasoning about actions. We show how the infor- quired to add new information (a new action or effect) to the
mal requirements of cohesion and coupling can be representation is proportional to the complexity of that infor-
turned into consistency tests of several different ar- mation [Shanahan, 1997]. Items 1, 2 and 3 reflect the concept
rangements of modules. This gives us new criteria of modularity, which means that different modules have no
for domain description evaluation and clarifies the elements in common. Such a notion of modularity is going to
link between software and knowledge engineering lead us along the present work.
in what concerns the meta-theory of actions.
This paper is an elaboration of the results we have pre-
sented in [Herzig and Varzinczak, 2004]. Here we pursue the
1 Introduction following plan: in Section 2 we recall some important con-
cepts from software engineering; after discussing the ontol-
Among the principles of the object-oriented paradigm are the ogy of dynamic domains (Section 3) we apply the concepts
following: of Section 2 to the design of domain descriptions (Sections 4
1. Work with modules (or components, functions, etc.). and 5) making a step towards formal criteria for domain de-
scription evaluation. In Section 6 we present the main results
2. Minimize interactions between such modules. that follow from our approach, and before concluding we ad-
3. Organize the modules into well-defined layers to help dress related work found in the literature on this subject.
minimize interactions. The goal is to have components
of one layer using only components from immediate 2 Some principles of software engineering
neighbors, wherever possible. One of the first steps in software development is that of ab-
4. Anticipate what kind of extensions or modifications straction. Abstraction consists mainly in rendering lower-
might be made in the future, and support this at design level details invisible to upper levels in order to facilitate the
time so that one can extend the system with minimal dis- understanding and design of complex systems. As an exam-
ruption later. ple, a specification of a data or knowledge base query does
not need to take into account the algorithmic process that will
There seems to be an agreement that such principles for be carried out in order to answer the query.
object-oriented programming or design are the same as for In parallel to abstraction, one of the most important guide-
knowledge representation. To witness, the design of domain lines in project design is that of modularity: dividing the soft-
descriptions in reasoning about actions has much more in ware into modules, based on their functionality or on the simi-
common with software engineering than one might think: in larity of the information they handle. This means that instead
the same way as for software projects, one can talk about con- of having a “jack of all trades” program, it is preferable to
sistency, evolution and correctness of domain descriptions. split it up into specialized subprograms. For instance, a pro-
All the principles above can be applied to the design of do- gram made of a module for querying a database and a module
main descriptions, too. We argue that a good domain descrip- for checking its integrity is more modular than a single mod-
tion should be one whose consistency check and maintenance ule that does these two tasks at the same time.
complexities are minimized, so that any further modification Among the major benefits of modular systems are reusabil-
is localized, with a bounded scope. ity, scalability and better management of complexity.
£
Supported by a fellowship from the government of the F EDER - There is more than one way to split up a program. One
ATIVE R EPUBLIC OF B RAZIL. Grant: CAPES BEX 1389/01-7. of the most used techniques is that of forcing functional in-
3. Inexecutability laws The design of domain descriptions For parsimony’s sake, we define , csqqcS
V T S r p T p ubtW
a Y X
must also provide a way to express qualifications of actions, , and
wb`vr
V a Y X W . We suppose all these sets are
ydcvxDdcS
V Y a S r p Y a
i.e., conditions under which an action cannot be executed consistent.
at all. An inexecutability law for action is of the form 4 A domain description
is a tuple of the form €
.
i„d6dc!ƒb`R!‚cS
… g h g f Y a S a Y X W T
( H '@8
0
Poss 165
4
Once the information contained in a module is not mixed
where is a simple state formula about .
'@8
with others’, it can be expected that undesirable side effects
For example, HasGun 0
Poss shoot states that
I
(
0
due to further modifications are less likely to propagate to
shoot cannot be executed if the agent has no gun. other parts of the domain description. The same thing can be
State constraints (alias domain constraints) Frameworks obtained for the consistency check if beyond of being sepa-
allowing for indirect effects make use of formulas that link rated the modules are designed in such a way that their inter-
invariant propositions about the world. Such formulas char- action is minimized. This is what we address in this section.
acterize the set of possible states. A state constraint is a sim- As we have seen, in software engineering functional inde-
ple state formula about the situation term that is consistent.
pendence is evaluated by means of two criteria: cohesion, a
An example is walking alive , saying that if a turkey
)
( '
criterion for evaluating the relative functional strength of a
is walking, then it must be alive [Thielscher, 1995]. module, and coupling, an assessment of relative interdepen-
dence among different modules. Both these notions are quite
Executability laws With only state constraints and effect informal, even in software engineering, and cannot be mea-
laws one cannot guarantee that action shoot is executable if sured in an objective way.
the agent has a gun. An executability law for action is of 4 Here we explore these concepts when applied to domain
the form P'@8
( Poss , where is a simple state
65
4 @8
descriptions and show how the informal requirements of soft-
formula about . For instance HasGun
Poss shoot @
( 1
ware engineering can be turned into tests of consistency of
says that shooting can be executed whenever the agent has a several different arrangements of modules.
gun, and Poss tease that the turkey can always be teased.
1
Whereas all the extant approaches in the literature that al- 4 Cohesion
low for indirect effects of actions contain state constraints
and effect laws, the status of executability laws is less con- Normally cohesion comes with modularization, and its eval-
sensual: some authors [Schubert, 1990; Doherty et al., 1996; uation depends mainly on the entities that one takes into ac-
McCain and Turner, 1995; Thielscher, 1995] more or less tac- count when describing a domain.
itly consider that executability laws should not be made ex- In talking about sets of logical formulas we take cohesion
plicit but rather inferred by the reasoning mechanism. Others as how simple or well-defined a logical module is, consider-
[Lin, 1995; Zhang et al., 2002] have executability laws as first ing the different types of formulas that can be derived from it.
class objects one can reason about. We thus refine our first design principle:
We nevertheless would like to point out that maximizing P1’. The less types of laws a given module entails alone, the
executability, as usually done in the literature, is not always more cohesive it is.
intuitive: suppose we know that if we have the ignition key, As an example consider the following module:
the tank is full, , and the battery tension is beyond 10V,
RRQ
Q Q †
then the car (necessarily) will start. Suppose we also know
0
HasGun ( ) '
0
Poss shoot
F1
that if the tension is below 8V, then the car will not start. What HasGun A'
( Poss shoot
1
‡
should we conclude in situations where we know that the ten- From such a set alone one can derive both HasGun 0
( D '
sion is 9V? Maximizing executabilities makes us infer that it 0
Poss shoot and HasGun
Poss shoot , which are
1
A
( 1
will start, but such reasoning is not what we want if we would formulas of two different kinds. In this case we say that such a
like to be sure that all possible executions lead to the goal. set is a lowly cohesive module, for alone it functions to derive
It seems a matter of debate whether one can always do executabilities and inexecutabilities. A better approach would
without executabilities. We think that in several domains one be to decompose such a module into the following ones:
wants to explicitly state under which conditions a given ac-
tion is guaranteed to be executable, such as that a robot should ˆtW
a Y X shoot p
0
HasGun A
(
0
Poss shoot
never get stuck and should always be able to execute a move shoot HasGun
dcS
Y a Poss shoot p ( H '
1
action. In any case, allowing for executability laws gives us
Total cohesion is not always easy to achieve. Suppose, for
more flexibility and expressive power.
instance, a hypothetical situation in which we reason about
Domain descriptions Given the four types of entities de- the effects of drinking a cup of coffee:
”
fined above, we arrange them in the following way: for a Poss drink )1
(
given action , 4 is the set of its effect laws,
IUS
V T is the `b`W
V a Y X ’
sugar happy do drink )
( F3
set of its inexecutability laws, and is the set of its ex- edcS
V Y a T US drink ‰‘‘ p
Poss drink )1
(
‘‘•
ecutability laws. denotes the set of all state constraints
g ih %f
g
salt happy do drink )
(
0
31
–
of a given domain. Thus, , and T , for each
cS V V dUS
Y a V b`RW
a Y X ‘‘“ ‘‘
action , and
4 gare the natural modules we consider here
ih %f
g Then, drink entails sugar
T cS salt Poss drink . F '
— H3
(
0
1
in designing a domain description. This means that from drink alone we do not get only effect T cS