344 karma · joined Dec 16, 2014 (11y ago) · 112 submissions
comment 7mo ago · link · parent
comment 7mo ago · link · parent
comment 7mo ago · link · parent
comment 7mo ago · link · parent
It'll take some time for those apps/tools to realize the full potential of statecharts, but it's a good start.
comment 7mo ago · link · parent
I created XState, a JS/TS library for authoring, executing, and visualizing state machines/statecharts: https://github.com/statelyai/xstate
I've been working on it for 10+ years. The main thing I've learned is that statecharts are most valuable when they're treated as executable behavior, not just documentation.
That doesn't mean you need to use them everywhere or model everything with them. They're most useful when you have behavior where the answer to "what happens next?" depends on both the current state & the event. A statechart can act as an oracle for questions like: "Given I'm in this state, when this event happens, what is the next state, and what effects should run?"
I'm close to releasing an alpha of the next major version of XState, focused on better ergonomics, type safety, and composability, as well as a new visualizer/editor.
There's also an open-source basic statechart visualizer here: https://sketch.stately.ai
For the formal/spec side, SCXML is worth reading: https://www.w3.org/TR/scxml
Also worth reading the original paper by David Harel: https://www.weizmann.ac.il/math/harel/sites/math.harel/files...
comment 1y ago · link · parent
I also like the approach of Svelte, and realize that sometimes a full state machine isn't needed. I don't think that atoms should be used everywhere, since updating state freely without guardrails just leads to disaster long-term.
comment 1y ago · link · parent
I plan on greatly simplifying it for the next major version, mostly to be more idiomatic and flexible without sacrificing the state machine principles.
comment 2y ago · link · parent
[0] https://state.new [1] https://github.com/statelyai/xstate
comment 2y ago · link · parent
comment 2y ago · link · parent
comment 2y ago · link · parent
comment 2y ago · link · parent
I love that use-case. We have plenty of developers & companies using XState on the backend, and one of our main goals for XState v5 was to enable more backend use-cases, with custom & composable actor logic, deep persistence, inspection APIs, and actor-first statechart features for modeling more complex actor-actor interaction.
Ultimately, we'd love to be an open-source alternative to AWS Step Functions.
comment 3y ago · link · parent
comment 3y ago · link · parent
We're not trying to force state machines as the solution for any state-related problem; they're not a panacea, but instead a useful tool for the appropriate use-cases.
And we're definitely making a huge effort to improve the types.
comment 3y ago · link · parent
Just want to mention that we're very close to releasing XState v5 beta, which brings even more features to the state machines & statecharts you can create, and greatly improves the developer experience, but also makes it more usable as a general-purpose state management library (or orchestration "framework" if you want to consider it that), whether on the frontend or backend.
comment 4y ago · link · parent