Book a Demo

Author Topic: composite state  (Read 5718 times)

Bokkie

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • Lima Bravo!
    • View Profile
composite state
« on: February 06, 2008, 11:49:27 pm »
Hello UML Gurus!

Question regarding composite & concurrent states:

Imagine a a composite state (named A), consisting of two concurrent sub-statemachines/regions: each concurrent sub-statemachine has 2+ states.

What happens when state A transits to state B on trigger X. Are the A its sub-statemachines implictly aborted? When state A is entered again, do the concurrent sub-statemachines start in their initial state?

Or must trigger X explicitly end the sub-statemachines?

Regards,

Martin
Lima Bravo!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: composite state
« Reply #1 on: February 07, 2008, 03:25:52 am »
UML will allow you to model it any way you want. At least as far as building a state machine diagram.

As to what the model means, you are somewhat on your own. How do you think it should work? For example, if you allow a transition back into A, shouldn't the A.Initial state be invoked? If not, perhaps your design is overlooking something. It is easy to say "transitions internal to the composite state are allowed to break the rules." But doing so suggests that the 'decomposition' could use some additional attention.

HTH, David
No, you can't have it!

revdev

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • Love this stuff.
    • View Profile
Re: composite state
« Reply #2 on: February 07, 2008, 11:42:00 am »
Yes, the state machines in A are aborted.  I would advise using a synchronous architecture so that all state actions are complete before leaving a state (a basic rule of MDA).  

On transition out of a state, the exit action of the state is invoked.  In the case of a composite state, I believe you have a choice (as far as the OMG is concerned) as to which exit routines to invoke, should they exist.  I suggest invoking the exit action of the current substate first, followed by that of the superstate.

On transition back into composite state A, the response is dependent on whether you use a history node.  If such a node is used the transition results in returning to the last active substate.  History nodes can be shallow or deep.

Hope that helps.
Bruce
re-Vision Development