将 Web 用户控件建模为状态机是否不好?

发布于 2024-07-29 21:45:09 字数 137 浏览 6 评论 0原文

我们正在设计一个 Web 用户控件,它可以执行一些不同的操作。 它从其内部或外部获取事件,并且对这些事件的响应取决于该控件的状态。

我们正在考虑将建模视为状态机,但我们认为这可能太令人讨厌或对其他人来说难以理解。 你认为这是真的吗?

We're designing a web user control, which does some different things. It gets events from inside it or outside it, and the response to these events depend on the state of this control.

We're thinking of modeling as a state machine, but we think it might be too geeky or hard for someone else to understand. Do you think this is true?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冷清清 2024-08-05 21:45:12

在大学,我们积极鼓励这样做……我倾向于同意 John D. 的观点,即即使您以前从未见过它们,它们也很容易遵循。

请参阅我去年参加的 HCI 课程的第 10 讲

At Uni we're actively encouraged to do this... and I tend to agree with John D. that they are easy to follow even if you have never seen them before.

See lecture 10 of the class I attended last year on HCI.

七度光 2024-08-05 21:45:12

也许向非技术用户询问这个问题,对我来说它可以继续下去。

Maybe to ask non technical users about this, for me it can go on.

明月夜 2024-08-05 21:45:11

我不这么认为,状态机非常容易绘制为流程图。 许多非技术人员即使从未听说过“状态机”,也可以阅读流程图。

I don't think so, state machines are extremely easy to draw as flow charts. And many non-technical people can read flow chart even if they've never heard of a "state machine."

温柔女人霸气范 2024-08-05 21:45:11

如果您可以将应用程序的控制流建模为状态机,那么我认为您应该这样做。 正如其他人所说,状态机很容易以流程图形式可视化。 然而,更重要的是,使用状态机作为模型可以使验证代码的正确性变得非常简单,因为您可以确认代码涵盖了每个状态以及状态之间的每个转换。

正是出于这个原因,为微控制器编写的代码通常使用这种方法来设计和实现。

冒着引发口水战的风险,我还要郑重声明,任何发现状态机“太极客或难以理解”的人都没有业务编程能力。 毕竟,正则表达式是一个有限状态机。

If you can model your app's control flow as a state machine, then IMO you should. As others have said, state machines are quite easy to visualise in flowchart form. More importantly, however, having a state machine as your model makes validating the correctness of your code much, much simpler, because you can confirm that the code covers every state and every transition between states.

Code written for microcontrollers is often designed and implemented using this approach for exactly this reason.

At risk of provoking a flamewar, I'll also state for the record that anyone who finds a state machine "too geeky or hard to understand" has no business programming. A regular expression is a finite state machine, after all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文