开发者

How do I communicate with the user in a finite state machine implementation?

开发者 https://www.devze.com 2022-12-18 21:18 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号