Cohesion, coupling and the meta-theory of actions
Andreas Herzig and Ivan Varzinczak
IRIT – Universit´ Paul Sabatier
118 route de Narbonne – 31062 Toulouse Cedex 04 France
e-mail: herzig,ivan @irit.fr ¢
Abstract With this in mind, one can see the speciﬁcation 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 reﬂect the concept
rangements of modules. This gives us new criteria of modularity, which means that different modules have no
for domain description evaluation and clariﬁes 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-deﬁned 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 ﬁrst steps in software development is that of ab-
4. Anticipate what kind of extensions or modiﬁcations 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 speciﬁcation 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 modiﬁcation Among the major beneﬁts 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-
Inexecutability laws The design of domain descriptions For parsimony’s sake, we deﬁne , csqqcS
V T S r p T p ubtW
a Y X
must also provide a way to express qualiﬁcations of actions, , and
V a Y X W . We suppose all these sets are
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
g h g f Y a S a Y X W T
( H '@8
Once the information contained in a module is not mixed
where is a simple state formula about .
with others’, it can be expected that undesirable side effects
For example, HasGun 0
Poss shoot states that
due to further modiﬁcations 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
descriptions and show how the informal requirements of soft-
formula about . For instance HasGun
Poss shoot @
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.
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-deﬁned a logical module is, consider-
[Lin, 1995; Zhang et al., 2002] have executability laws as ﬁrst ing the different types of formulas that can be derived from it.
class objects one can reason about. We thus reﬁne our ﬁrst 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,
then the car (necessarily) will start. Suppose we also know
HasGun ( ) '
that if the tension is below 8V, then the car will not start. What HasGun A'
( Poss shoot
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
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
never get stuck and should always be able to execute a move shoot HasGun
Y a Poss shoot p ( H '
action. In any case, allowing for executability laws gives us
Total cohesion is not always easy to achieve. Suppose, for
more ﬂexibility 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:
ﬁned above, we arrange them in the following way: for a Poss drink )1
given action , 4 is the set of its effect laws,
V T is the `b`W
V a Y X
sugar happy do drink )
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
salt happy do drink )
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
g Then, drink entails sugar
T cS salt Poss drink . F '
in designing a domain description. This means that from drink alone we do not get only effect T cS