Statechart vs MSM

Slide from Kris Jusiak’s CppCon 2018 presentation: State Machine Battlefield:Native vs STL vs Boost – Pg. 172 in the PDF


Andreas Huber Doenni – Author of Boost Statechart

David Abrams, one of the founders of Boost and author of boost::mpl was pretty clear in his views regarding whether states should contain member variables…

https://lists.boost.org/Archives/boost/2005/02/80319.php

Christophe Henry – Author of Boost MSM

Jeff Garland and Andreas Huber discussing that the UML standard and Object Oriented programming do not agree when it comes to the idea of state member variables.

https://lists.boost.org/Archives/boost/2005/02/81020.php

See Chapter 15 : State Machines, Pg 523 for a description of behavioral vs. protocol state machines.

https://www.omg.org/spec/UML/2.0/Infrastructure/PDF

Bottom Line: In Protocol state machines, states are just names (strings in a transition table) and any data that you would like to store in the machine has to be stored in the state machine itself (globally), which is not good. This type works fine for vending machines, alarm clocks, traffic lights and other simple devices. Boost MSM is ideal for this type. On the other hand, Behavioral state machines need classes with state class member variables and functions (states are classes). This allows them to say, have a state where a tank is navigating from point a to point b, while simultaneously managing a satellite link, acquiring a radar signature and finally engaging the target while on the move. – Which is awesome, and that’s why Boost Statechart , and by virtue of inheritence, SMACC is awesome.