Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Check out "Practical State Charts in C/C++" by Dr. Miro Samek.


Notes:

The 2nd Edition is better than the 1st Edition, because it does not have the distracting analogies to quantum physics. For me, the best part of Samek's book was Chapter 5, State Patterns. However, he also covers Standard State machine Implementations (and their flaws) in Chapter 3. Chapter 6, Realtime Framework Concepts, covers WHY you want to take special care in implementing a state machine, such as avoiding corrupting the current event in order to preserve RTC semantics. You will not get a more coherent presentation of these issues anywhere else. You could spend years of your life reading CS papers on the subject, implementing state machines, etc. and not come to the mastery Samek has. My favorite quote from the whole book has to be pointing out deviating from a simple Moore FSM, by introducing guards, can cause big trouble. He says overuse of guards is "[the source of] architectural decay" in complex reactive systems.

The one thing I disagree with Samek about is that transitions have any state context associated with them. For me, transitions occur between states. This approximates the design of Mealy actions going between Moore actions., and is closest to the semantics of object-orientation, since the sender does not need to know the receiver directly. Samek presumes actions are dependent on the source context, but if there are two outgoing transitions from a source context, they probably will not have the same action. You move to a state before entering that state, and you move out of a state before moving to another state.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: