Boost logo

Boost :

Subject: Re: [boost] [msm] Review
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2009-12-06 03:37:34


Hi David,

Thanks for bringing some depth to the discussion.

>2. In Statechart, the definition of a state is coupled to the machine in which it resides
> while in MSM the state can be defined totally in isolation of the machine, and, thus, reused in other machines
>3. In Statechart, the transitions are coupled to the from-state, and defined therein,
> whereas in MSM, the transitions are coupled to the machine itself; this makes it a bit tricky to reuse a state in Statechart

This is an important interface difference, isn't it?

> 5. MSM has eUML, which I have *not* used, to simplify the machine specification.

I'd also count it as an important interface difference.

You brought the following example, which will be a good starting
point. Unfortunately, you seem to want to make it tell too much about
Statechart/MSM similarities (I read "fairly similar") so let's tough
it out a little.
With Statechart, you had:

struct State1 : simple_state<State1, Machine> {
  typedef transition<Event, State2, Machine, &Machine::action> reactions;
};

And with MSM:
  typedef mpl::vector<
    a_row<State1, Event, State2, &Machine_::action>
> transition_table;

Now this example is a bit too simple to see a huge difference, so it
is slightly misleading. If you don't mind, let's add a very simple
thing, a guard (which is a boolean condition having the right to
prevent the triggering of a transition).
With MSM this becomes:
  typedef mpl::vector<
    row<State1, Event, State2, &Machine_::action, &Machine_::some_condition>
> transition_table;

Could you you maybe now show us how the Statechart version will look like?

Let's now add a conflicting transition, which means another possible
transition on the same event and the same source state, with guards
deciding which (if any) transition will be taken.
With MSM you'd have, for example:
  typedef mpl::vector<
    row<State1, Event, State2, &Machine_::action, &Machine_::some_condition>,
    row<State1, Event, State3, &Machine_::action,
&Machine_::some_other_condition>
> transition_table;

Could you now write the Statechart version for us?

How easy is your Statechart->MSM translator now? (Note:
MSM->Statechart will stay pretty simple, right?)
After seeing both versions, will we all agree that there are important
interface differences and that these differences are an important
distinguishing feature?

Christophe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk