2 ms·
One of my favorite tools! I've implemented many (too many) protocols with HSMs. I've also implemented lots with traditional FSMs. I've met people like me who ha
by stelfer 12y ago
One of my favorite tools! I've implemented many (too many) protocols with HSMs. I've also implemented lots with traditional FSMs. I've met people like me who have done both. Most would choose HSMs for most applications. If you're into SM compilers then they might not be that interesting (I'm not -- I like to see the logic in code that _I_ write).
As an exercise in seeing the advantages, take a look at a network protocol RFCs like for TCP, BGP or SIP, and redraw the state diagrams there as statecharts. I've found that HSMs help in the beginning when I'm understanding what I'm doing (how about finding omitted states!); in the middle as I'm implementing; and in the end, when I'm maintaining. In my experience they definitely commend themselves vis-a-vis FSMs in commando ops (i.e. parachute a smart engineer into hostile unknown territory and have them fix a broken state machine under heavy fire).
Of course, much depends on your HSM implementation itself. This book (http://www.state-machine.com/psicc/ http://www.state-machine.com/psicc/) is a good resource, though the last time I looked the code is sorta old-timey C++. There are definitely more contemporary/template-ly ways to do it.