TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

JavaScript/TypeScript finite state machines and statecharts for the modern web

20 点作者 hacksilver大约 4 年前

1 comment

imbnwa大约 4 年前
Something this formally explicit about FSMs strikes me as most valuable for Product Managers or QA who, in my career so far, tend to need help clarifying their thinking, so as a backend to some tool like that.<p>Most engineers are encoding a state machine <i>somewhere</i> in their code, either implicitly or not. But whether an engineer gets more value out of formalizing the code around it like this is up for debate to me. Maybe as a first iteration as way to approach correctness first for those Javascript projects whose requirements aren&#x27;t too demanding or where the team has issues around thinking explicitly about how to eliminate invalid states (which, to be fair, there are enough of those some team somewhere should consider it), but at the same time a testing regime could accomplish the same thing (ensuring only valid edges between states are traversible, the right IO called at entry&#x2F;exit of a state, etc but IIRC it assumes a JS environment) without &quot;stretching out&quot; your code surface to formally describe a compound state machine.<p>I do think as a data representation though, SCXML is likely very attractive for IVR projects, or any project where a user is navigating some state machine via input cause you can separate the domain from the FSM description (via XML namespacing is one way, though SCXML does have elements for describing domain data, simple logic, etc), which makes the data you really care about more framework&#x2F;language agnostic