A tutor wrote:

1. The transitions with events "insert 20p"/"debit 20p" going from the Credit superstate back to itself can be triggered from any of the substates, but will they also keep the system within the same substate? Or will they take it back to "Waiting for number", the default state within the superstate? Generally speaking, wouldn't each transition going into the superstate lead the system to the first substate from there if a start marker is used within?

This is a very good point - well done the students that raised that! Indeed, this relates to an area of UML state diagrams that has changed.

What's technically needed here is what's called a "local" transition, which probably hadn't been added to UML when that exam question was written. See p590, p591 of the UML Superstructure document:

"kind=local implies that the transition, if triggered, will not exit the composite (source) state, but it will apply to any state within the composite state, and these will be exited and entered." [p590]

"Notation. Transitions of kind local will be on the inside of the frame of the composite state, leaving the border of the composite state, or one of its entry points, and end at a vertex inside the composite state. In the case of a local self transition, the target may be the source state itself, or an exit point on the source state. Alternatively a transition of kind local can be shown as a transition leaving a state symbol containing the text "*." The transition is then considered to belong to the enclosing composite state. All of the transitions in Figure 15.47 are local." [p590]

And Fig 15.47 shows, among other things, a transition that looks just like ours, but on the inside of the composite state boundary (still joining one point on the boundary to another).

"Changes from previous UML The semantics implied by local is new." [p591]

I think it was newly added precisely because there's so often a need for the kind of semantics we want here, and people were using self transitions from a composite state to itself to represent both what we want here and what you correctly say they technically mean. It's quite hard to think how else you can notate what we mean here - my first thought was to use a history state in place of the initial state inside Credit, but that will cause the insert20p transition also to go back to whatever substate we left from, which isn't what we want.


This page is maintained by Perdita Stevens (perdita@inf.ed.ac.uk)


Home : Teaching : Courses : Seoc : 2014_2015 : Tutorials 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh