How do I communicate with the user in a finite state machine implementation?
Basically I have a custom implemented finite state machine that mostly lis开发者_StackOverflowtens for hardware switch state changes for initiating transitions, but some things need communication with the user...
For instance, the user needs to tell it whether to repeat or save and reset.
I have a pretty good idea of how to do it... I can raise events when it gets to that point, and then the UI layer will ask the user and then trigger the transition, but is there some better way or some patterns I should be following?
Just looking for some insight so I don't do this the wrong way.
I'm marking this as community wiki since it's not really a single answer type of question.
I'd guess that a natural way to organize such communication would be to set up a special state (or states) in your machine.
Start -> Ask user's name -> Say hello
精彩评论