Hi Andreas,
Dear all
Recently I discovered MSM - a very nice piece of code!
Thanks :)
It let me define the state machine decoupled from the other business logic code what brought me easier unit testing and easier life :-)
Really nice so far. This week I faced the following situation: my MSM accepts and processes events BEFORE its start() method was called. Is this behavior by design? I know other state machine implementations which do not accept any events until they are started. If the MSM's behavior related to this start issue is on purpose, can anybody tell me the background? Just curious if others have same thoughts or if my mind acrobatic is totally odd.
This is by design. Actually it just means "call first state entry action (initial state)" but it was more readable than "call_inital_state_entry". The rationale is, MSM actually doesn't need a start(), but first MSM users complained that MSM was calling on_entry on initial state upon creation and they wanted to choose the time themselves. I although thought I could do other things in start() one day but I never did. The same way, you also have a stop(), which calls on_exit on the last active state(s). You can omit both, simply on_entry of initial state(s) and on_exit of the last active state(s) (and of the state machine itself) will not be called. This means that most of the time, if you forget start(), nothing bad happens.
Thanks for any comments
Andi
HTH, Christophe