Boost Statechart vs. Meta State Machine

FireAphis picture FireAphis · Nov 25, 2010 · Viewed 32.5k times · Source

Apparently boost contains two separate libraries for state machines: Statechart and Meta State Machine (MSM). The taglines give very similar descriptions:

  • Boost.Statechart - Arbitrarily complex finite state machines can be implemented in easily readable and maintainable C++ code.
  • Meta State Machine - A very high-performance library for expressive UML2 finite state machines.

Do you know what are the key differences and what are considerations in choosing between the two?

Answer

Christophe Henry picture Christophe Henry · Nov 26, 2010

As there seems to be much interest, please allow me to give my (obviously biased) opinion, which should therefore be taken with a grain of salt:

  • MSM is much faster
  • MSM requires no RTTI or anything virtual
  • MSM has a more complete UML2 support (for example internal transitions, UML-conform orthogonal regions)
  • MSM offers a descriptive language (actually several). For example, using the eUML front-end, a transition can be described as Source + Event [Guard] / Action == Target
  • MSM will make your compiler suffer for bigger state machines, so you will need a pretty recent compiler (g++ >= 4.x, VC >= 9)

You can make yourself a better opinion by looking for comments posted during the review of MSM. This subject was much discussed on the developer list.