glyph@mastodon.social
glyph@mastodon.social

Re-writing Automat's documentation from scratch now since everything is different, and going from the "coffee machine" stilted and artificial example of a state machine to the "garage door opener" stilted and artificial example of a state machine for introducing stuff. I want to use a realistic example, but every real problem I want to use automat for is a 1000 line rat's nest of complex interactions (which is exactly why I need a framework to manage it). Is there a good exemplary DFA I can use?

|
Embed
Progress spinner
nickzoic@aus.social
nickzoic@aus.social

@glyph when teaching programming things I always tried to go for the least technical thing imaginable: "making a sandwich" or something like that. Familiarity helps, plus there's not much risk of terminology overlapping.

|
Embed
Progress spinner
slott56@fosstodon.org
slott56@fosstodon.org

@glyph my fallback is card or dice games. Few states. Few transitions. Casino craps has two states and not too complicated transitions.

|
Embed
Progress spinner
meejah@mastodon.social
meejah@mastodon.social

@glyph I like protocol examples, since it's mostly "for" protocols in at least some sense (i.e. the sense where Automat is a Twisted dependency ;)

An "echo" server is pretty trivial -- but (simplified) SOCKS5 gives you a little more, but still smol state-machine?

That said, when double-checking my _actual_ (early) attempt at that, you'd almost certainly want to simplify for an example...

|
Embed
Progress spinner
jbcrail@mastodon.social
jbcrail@mastodon.social

@glyph I wrote something similar a few years to demo FSMs that may be useful for inspiration. I included a few realistic examples that occurred often as an application developer, e.g a document approval workflow, state of a GUI button, and TCP state. The demo with those examples is github.com/jbcrail/fsm-demo.

A finite state machine that represents a simplified document approval workflow.

A finite state machine that represents a simplified TCP state diagram.

|
Embed
Progress spinner
In reply to
Contrariwise
Contrariwise

@glyph I used automat back in ~2019 to implement craps. The entire craps table is a MethodicalMachine. The problem is that I don't think many people know how to play craps in the first place, so it's probably a terrible example.

|
Embed
Progress spinner
glyph@mastodon.social
glyph@mastodon.social

@Contrariwise I certainly don’t! Which makes me a particularly bad person to write documentation using it

|
Embed
Progress spinner
ericsuh@mastodon.social
ericsuh@mastodon.social

@glyph How about a GitHub Pull Request? I feel like there aren’t too many states or transitions as long as you elide the “extra” features, and many programmers will already be familiar with the core concepts.

|
Embed
Progress spinner
glyph@mastodon.social
glyph@mastodon.social

@ericsuh hmm. An interesting idea…

|
Embed
Progress spinner