reflected in the states (single or married) of the
participants via the derived state of their Marital
Status mixin.
This determines the way the model behaves
when executed. If a marriage is dissolved, both
participants become single. Also, if a married person
dies, their spouse will become single. This is
because, once the Marriage has been dissolved or
one of the partners dies, the “Is Valid” attribute of
Marriage is no longer true.
Contrast this with the way this small problem
would be modelled using the Executable UML
approach. Without the ability to derive states, the
state transition diagram for a Person would need to
reflect all the reasons for a transition from the
married to single state, as shown in Figure 10.
Figure 10: “Executable UML” State Diagram for Person
In this solution, if a married person dies, it is
necessary for some object to send a message to the
spouse to announce the death and fire the “Spouse
Dies” transition. Similarly, the Dissolve event must
be sent to both partners in the marriage. In general, a
single event must be sent to, and reflected in,
multiple objects to keep their states synchronized.
In the language of the new UML version 2
standard (OMG, 2003b p. 455), the state machines
defined for the mixin based approach in Figures 3, 4
and 7 are pure “Protocol State Machines”, as the
diagrams are only concerned with defining the state
or states in which it is possible for an event to occur.
Because of the presence of state synchronization
transitions, Figure 10 is not a Protocol State
Machine but something more complex. This can be
seen clearly by noting that whether or not a person
can die is, in the real world, completely
unconstrained by the existence or state of that
person’s spouse. In other words, the transition
“Spouse Dies” in Figure 10 has no protocol
significance.
The complexity involved in sending the same
event to multiple objects to achieve state
synchronization, combined with the stricture that an
object is modelled with a single state transition
diagram, can cause the diagrams to become large
and hard to understand when modelling objects with
complex behaviour. Protocol State Machines,
constructed by composing mixins, provide a more
scalable approach because the individual state
diagrams remain small and relatively simple.
The importance of derived attributes in reducing
redundancy in the information schema of a model is
well known and accepted. Using mixins which may
have derived states extends the same idea to state
transition based behaviour modelling.
6 FURTHER WORK
Our interest is in the use of executable
behaviourable modelling to validate models at an
early stage in the development lifecycle. We believe
that models built using the mixin based approach
described in this paper are well suited for this
purpose, and are developing software that supports
direct execution of such models. Further information
about this can be found at
www.metamaxim.com.
PERSON
Born
Marr
REFERENCES
Soley, R., 2002. Presentation: MDA: An Introduction.
Retrieved October 2003 from the Object Management
Group website:
www.omg.org/mda/presentations.htm.
OMG, 2003a. UML 1.5 with Action Semantics, Document
reference formal/03-03-01 March 2003. Available
from the Object Management Group website:
www.omg.org.
Harel, D., 1987. Statecharts: A visual formalism for
complex systems. In Science of Computer
Programming, no. 8,1987, pp. 231-274.
Mellor, S., and Balcer, M., 2002. Executable UML: A
Foundation for Model-Driven Architecture. Addison
Wesley, 2002.
Jackson, M., 1995. Software Requirements and
Specifications: A lexicon of Practice, Principles and
Prejudices. Addison Wesley, 1995.
McNeile, A., and Simons, N., 2003. State Machines as
Mixins. In The Journal of Object Technology, vol. 2,
no. 6, November-December 2003, pp. 85-101.
Hoare, C., 1985. Communicating Sequential Processes.
Prentice-Hall International, 1985.
D’Souza, D., and Wills, A., 1998. Objects, Components,
and Frameworks with UML. The Catalysis Approach.
Addison Wesley, 1998.
Cook, S., and Daniels, D., 1994. Designing Object
Systems. Object-Oriented Modelling with Syntropy.
Prentice Hall, 1994.
OMG, 2003b. UML 2.0 Superstructure Final Adopted
specification, Document reference ptc/03-08-02
August 2003. Available from the Object Management
Group website:
www.omg.org.
S
ouse Dies
Single
married
Die
dead
MIXIN BASED BEHAVIOUR MODELLING - An example based on composed state machines
183