FELR98 B
FELR98 B
FELR98 B
R. France
Department of Computer Science & Engineering
Florida Atlantic University, Boca Raton, Florida, USA
A. Evans K. Lano
Department of Computing Department of Computing
Bradford University, Bradford, UK Imperial College, London, UK
B. Rumpe
Department of Computer Science
Munich University of Technology, Munich, Germany
1 Introduction
The popularity of object-oriented methods (OOMs) such as OMT 16] and the Fusion Method 5], stems
primarily from their use of intuitively-appealing modeling constructs, rich structuring mechanisms, and
ready availability of expertise in the form of training courses and books. Despite their strengths, the
use of OOMs on nontrivial development projects can be problematic. A signi cant source of problems
is the lack of semantics for the modeling notations used by these methods. This can lead to the
following problems:
Understanding of models can be more apparent than real. A stated strength of OO modeling
notations is their intuitive appeal, reducing the e ort required to read and understand the mod-
els. The lack of precise semantics for OO notations can result in situations where a reader's
interpretation is not the same (or is not consistent) with the model creator's interpretation. Un-
less the reader (e.g., a customer) and creator (e.g., a software analyst) explicitly communicate
their interpretations there is the danger that both will walk away with inconsistent views of the
modeled structure and/or behavior without realizing it. In the cases where the reader is respon-
sible for implementing the behavior speci ed in the models the result can be an implementation
that is not consistent with the view of the models. To compound the problem, it is dicult to
rigorously establish consistency of the models and their implementations. Communication also
becomes problematic when the concepts used to explain the modeling constructs have no precise
meaning, and are themselves subject of misinterpretation.
Developers can waste considerable time resolving disputes over usage and interpretation of no-
tation. In practice, the use of OOMs can lead to situations where it is not clear to the users of
the methods which of a number of opposing views on interpretation and usage is appropriate.
Appeal to textbooks is often not helpful because of the lack of meaningful examples and the
informal descriptions provided. Over time developers may develop a more precise variant of
the notation tailored to their development environment. These more precise interpretations are
developed by consensus and are based on interpretations provided by the tools used, the experi-
ences of the users, and the experiences of others they have come in contact with. This process,
if it exists within an organization, is very informal, and often the more precise interpretations
1
are not explicitly available to all engineers, rather they exist primarily in the heads of the more
experienced developers. Within a single organization, di erent teams may develop di erent vari-
ants of the modeling. This can result in communication problems when team members move
from project to project.
Rigorous semantic analysis is dicult. In practice OO models are validated and veri ed infor-
mally (in requirements/design reviews). These informal techniques are often inadequate they
cannot be used to rigorously establish that implementations and models are consistent with each
other, and rigorously establish that models capturing di erent views of the system are consistent
with each other. Review meetings can be further enhanced if the notations used have a precise
semantics. The results of model validations and veri cations can be presented in reviews as
evidence of the quality of the models. Such formal analysis serves to increase con dence in the
creative results of the modeling activity. Rigorous semantic analysis techniques also facilitate
the early detection of modeling errors which considerably reduces the cost of error removal.
Tool support limited to syntactic concerns. First generation tools supporting OO modeling
notations mainly focused on editing and drawing issues. As class diagrams (object models)
are based on entity-relationship-diagrams, considerable e ort is going into generating code, for
example, class frames and SQL tables, from them. Due to the lack of precise semantics there is
considerably less support for other modeling notations, usually leading to error-prone hand-made
translation into code.
The Uni ed Modeling Language (UML) 12] is a set of OO modeling notations that has been
standardized by the Object Management Group (OMG). It is dicult to dispute that the UML reects
some of the best modeling experiences and that it incorporates notations that have been proven useful
in practice. Yet, the UML does not go far enough in addressing problems related to the lack of
precision. The architects of the UML have stated that precision of syntax and semantics is a major
goal. In the UML semantics document (version 1.1) 11] the authors claim to provide a \complete
semantics" that is expressed in a \precise way" using metamodels and a mixture of natural language
and an adaptation of formal techniques that improves \precision while maintaining readability". The
meta-models do capture a precise notion of the (abstract) syntax of the UML modeling techniques
(this is what meta-models are typically used for), but they do little in the way of answering questions
related to the interpretation of non-trivial UML structures. It does not help that the semantic meta-
model is expressed in a subset of the notation that one is trying to interpret. The meta-models can
serve as precise description of the notation and are therefore useful in implementing editors, and they
can be used as a basis to de ne semantics, but they cannot serve as a precise description of the meaning
of UML constructs.
The UML architects justify their limited use of formal techniques by claiming that \the state of
the practice in formal speci cations does not yet address some of the more dicult language issues
that UML introduces". While this may be true to some extent, we believe that much can be gained
by using formal techniques to explore the semantics of UML. On the other hand, we do agree that
current text-based formal techniques tend to produce models that are dicult to read and interpret,
and, as a result, can hinder understanding of UML concepts. This latter problem does not diminish
the utility of formal techniques, rather, it obligates one to translate formal expressions of semantics
to a form that is digestible by users of the UML notation.
In this paper we discuss how experiences gained by formalizing OO concepts can signi cantly
impact the development of a precise semantics for UML structures. We motivate an approach to
formalizing UML concepts in which formal speci cation techniques (FSTs) are used primarily to gain
insights to the semantics of UML notations. The goal of our proposed UML formalization is to
2
produce a clear, precise expression of the UML notation semantics that can be used by users of the
UML notation. In section 2, we give an overview of other works on the formalization of OO modeling
concepts and relate it to our attempts at formalizing UML. In section 3 we describe the goals of the
PUML project and outline and motivate our formalization approach. In section 4 we illustrate our
formalization approach, discussing the structural view (class diagrams). We conclude in section 5 with
a summary and a list of some of the open issues that have to be tackled if our approach is to bear
meaningful results.
6
The third step of the formalization is concerned with de ning the mapping between the syntactic
domains (as characterized in step 2) and the semantic domains. The mappings relate syntactic con-
structs, such as class names, to semantic ones, like actual classes. The system model formally de nes
the set of all possible systems. A document of a given description technique is then de ned by relating
its syntactic elements to elements of a system, such as the existing set of classes, or other structural
or behavioral entities. The semantics of a document is then given by a subset of the system model.
This subset of the system model consists exactly of all systems that are correct implementations of
the document.
It is an important advantage, to separate formalization of the semantic domain and the semantics
mapping, by de ning the system model explicitly, because this leads to a better understanding of the
developed systems, allows the user to understand what a system is independently of the used notation,
and allows to add and integrate new OO diagram forms.
If the semantic domain is carefully de ned, then the mapping between syntax and semantics
becomes easier. If there is a larger coincidence between the syntactic and the semantic domain, then
the mapping may even be the identity to some extent. For example, if the notion of class does exist
in the semantics, either because it was de ned (e.g. a schema using Z), or it already exists in the used
language (e.g. Object-Z, Z++), identity can be used in this case. Thus, syntactic and semantic domain
may overlap to some extent. For convenience, we will allow such overlapping, but is important to be
aware of this situation to avoid confusion. It is also important that syntactic and semantic concepts
have the same meaning. For example, if the syntax allows the denotation of classes with publicly
accessible attributes, then a mapping to classes without such attributes is not appropriate.
It clearly is beyond the scope of this paper to carry out these steps. In the next section we give a
few examples of the formalizations that can be produced in our approach.
4 A Formalization Example
In this section, we formalize the meaning of a classi er in terms of the set of object instances that it
describes. To keep the example small, we show only the part of a formalisation that deals with classes
and attributes. Please note, that this section demonstrates the formalisation approach, especially the
separation of syntactic and semantic domains. It is however not intended to be already a considerable
contribution to the formalisation of UML.
4.1 Abstract Syntax
The rst step in formalizing the meaning of a classi er is to describe its abstract syntax.
First, it is assumed that there are the given sets:
ClassifierName AttributeName]
from which the set of all classifer and attributes names can be drawn.
A classi er has a name, and a set of attributes:
Classifier
name : ClassifierName
attributes : FFAttributeName
7
At any point in time, a UML model will contain a set of uniquely named classi ers:
AbstractSyntax
classifiers : FFClassifier
8c1 c2 : classifiers j c1 6= c2 c1 :name 6= c2 :name
The constraint of the schema states that each classi er must have a unique name.
4.2 System Model
In order to give meaning to classi ers, values must be assigned. In the UML, a classi er is viewed
as de ning a set of possible object instances. This is the `system model' that we adopt for our
formalization.
The given types ObjectName and AttributeLink describes the set of all object identities and
values of interest:
AttributeLink ObjectName]
An object is owned by a classi er, has a unique identity, and maps a set of attributes to their
values:
Object
owner : ClassifierName
name : ObjectName
attributes : AttributeName !7 7 AttributeLink
At any point in time, the meaning of a UML model is a nite set of unique object instances:
SystemModel
objects : FFObject
8o1 o2 : objects j o1 6= o2 o1 :name 6= o2 :name
9
1 *
Classifier Attribute
1 1
0..* *
1 *
Instance Value
Classifier
self.instances ; >
forall(i : Instance |
(i.values ; >
forall(v : Value |
v.attributes = self.attributes)) and
>
i.values; sum = self.attributes->sum)
The constraint states: (1) that each value of an instance must belong to the set of values permitted
by an attribute belonging to the owning classi er (2) the number of values an instance may have must
be equal to the number of attributes of the owning classi er.
However, although the UML description is simpler (and shorter) than the Z version, it su ers from
any means of proving properties about the components. This is a critical shortcoming which will need
to be addressed if a precise semantics and proof system for UML is ever to be developed using the
meta-model approach.
References
1] J. Bicarregui, K. Lano, and T. Maibaum. Objects, associations and subsystems: A heirarchical
approach to encapsulation. In Proceedings of ECOOP 97, LNCS 1489. Springer-Verlag, 1997.
2] Robert H. Bourdeau and Betty H.C. Cheng. A formal semantics for object model diagrams. IEEE
Transactions on Software Engineering, 21(10):799{821, October 1995.
3] Ruth Breu, Ursula Hinkel, Christoph Hofmann, Cornel Klein, Barbara Paech, Bernhard Rumpe,
and Veronika Thurner. Towards a formalization of the uni ed modeling language. In Satoshi Mat-
suoka Mehmet Aksit, editor, ECOOP'97 Proceedings. Springer Verlag, LNCS 1241, 1997.
4] T. Clark and A. Evans. Foundations of the Uni ed Modeling Language. In Proceedings of The
Second Northern Formal Methods Workshop. Springer-Verlag, 1997.
5] Derek Coleman, Patrick Arnold, Stephanie Bodo , Chris Dollin, Helena Gilchrist, Fiona Hayes,
and Paul Jeremaes. Object-Oriented Development: The Fusion Method. Prentice Hall, Englewood
Cli s, NJ, Object-Oriented Series edition, 1994.
6] Steve Cook and John Daniels. Let's get formal. Journal of Object-Oriented Programming (JOOP),
pages 22{24 and 64{66, July{August 1994.
7] Roger Duke, Paul King, Gordon A. Rose, and Graeme Smith. The Object-Z speci cation lan-
guage. In Timothy D. Korson, Vijay K. Vaishnavi, and Bertrand Meyer, editors, Technology of
Object-Oriented Languages and Systems: TOOLS 5, pages 465{483. Prentice Hall, 1991.
11
8] Robert B. France, Jean-Michel Bruel, and Maria M. Larrondo-Petrie. An Integrated Object-
Oriented and Formal Modeling Environment. To appear in the Journal of Object-Oriented Pro-
gramming (JOOP), 1997.
9] The UML Group. UML Metamodel. Version 1.1, Rational Software Corporation, Santa Clara,
CA-95051, USA, September 1997.
10] The UML Group. UML Object Constraint Language Speci cation. Version 1.1, Rational Software
Corporation, Santa Clara, CA-95051, USA, July 1997.
11] The UML Group. UML Semantics. Version 1.1, Rational Software Corporation, Santa Clara,
CA-95051, USA, July 1997.
12] The UML Group. Uni ed Modeling Language. Version 1.1, Rational Software Corporation, Santa
Clara, CA-95051, USA, July 1997.
13] J. Anthony Hall. Using Z as a speci cation calculus for object-oriented systems. In D. Bj rner,
C. A. R. Hoare, and H. Langmaack, editors, VDM and Z { Formal Methods in Software De-
velopment, volume 428 of Lecture Notes in Computer Science, pages 290{318. VDM-Europe,
Springer-Verlag, New York, 1990.
14] Cornel Klein, Bernhard Rumpe, and Manfred Broy. A stream-based mathematical model for
distributed information processing systems - SysLab system model - . In Jean-Bernard Stefani
Elie Naijm, editor, FMOODS'96 Formal Methods for Open Object-based Distributed Systems,
pages 323{338. ENST France Telecom, 1996.
15] Kevin C. Lano. Z++ , an object-orientated extension to Z. In John E. Nicholls, editor, Z User
Workshop, Oxford 1990, Workshops in Computing, pages 151{172. Springer-Verlag, 1991.
16] J. Rumbaugh, M. Blaha, W. Premerlani, F. Eddy, and W. Lorensen. Object-Oriented Modeling
and Design. Prentice Hall, 1991.
17] Bernhard Rumpe. Formal Method for Design of Distributed Object-oriented Systems. Ph.d. thesis
(in german), Technische Universit!at M!unchen, 1996.
18] J. Michael Spivey. The Z Notation: A Reference Manual. Prentice Hall, Englewood Cli s, NJ,
Second edition, 1992.
12