On 2/14/07, Wolfgang Frech <[EMAIL PROTECTED]> wrote:
Hello Rahul,

I think the following sketch is "extract content of state without
sequential substates":

The entry/exit action behavior and the name of the current (leave) state
should be identical.
The only observable difference if the additional state in the model and
as parent of a current state.
<snip/>

Yup.


Again, I left out the datamodel part.

<snap/>

Its optional, and currently in a state of flux anyway (so anyone
choosing to use it would have to be tolerant of changes going into
v1.0, whenever that happens).


Did I overlook anything?

<snip/>

No, its all good, but one observation below ...


Regards
Wolfgang

---
before

<scxml initialstate="a">
  <state id="a">
    <onentry>
      ((b))
    </onentry>
    <transition event="c" target="a">
      ((c))
    </transition>
    <transition event="d" target="e">
      ((f))
    </transition>
    <onexit>
      ((h))
    </onexit>
  </state>
  <state id="e">
    <transition event="g" target="a"/>
  </state>
</scxml>

==>

<scxml initialstate="a">
  <state id="_new" src="external.scxml">
  <state id="e">
    <transition event="g" target="a"/>
  </state>
</scxml>

<snap/>

There are two ways to treat src'ed in SCXML documents:

* As a white box (as you have above) where there are "dangling
references" (those that are only resolved at runtime) in the host
document i.e. state "a" does not exist in the above document, but in
external.scxml.

* As a black box, in which case one would author the above as follows
(which gives us an identical state machine as far as behavior is
concerned):

<scxml initialstate="_new">
   <state id="_new" src="external.scxml">
   <state id="e">
        <transition event="g" target="_new"/>
   </state>
</scxml>

Note that all the intialstate and targets are all available in this
document itself.

While there are usecases where both approaches make sense and Commons
SCXML doesn't impose any restrictions that would cause one to be
preferred over the other, from a purely design perspective the black
box approach improves readability (both human and tooling), probably
makes it easier to set up test rigs etc.

-Rahul


+ external.scxml

<scxml initialstate="a">
  <state id="a">
    <onentry>
      ((b))
    </onentry>
    <transition event="c" target="a">
      ((c))
    </transition>
    <transition event="d" target="e">
      ((f))
    </transition>
    <onexit>
      ((h))
    </onexit>
  </state>
</scxml>
 ---



--
Wolfgang Frech
iteratec GmbH
Inselkammerstraße 4   D-82008 Unterhaching
+49-89-61 45 51-64    Fax: -10
mailto:[EMAIL PROTECTED]   www.iteratec.de



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to