3 ms·
I really struggle with the value of simple state machine diagrams. For example, I get very little out of the Unix process state machine diagram. I've also seen
by abnry 4y ago
I really struggle with the value of simple state machine diagrams. For example, I get very little out of the Unix process state machine diagram. I've also seen designs involving just two states. What am I missing?
- michaelsbradley 4y agoYou might be missing Prof. Harel's innovations in the 1980s, which have seen and do continue to see use in a number of hardware/software engineering fields, but still seem to be mostly under appreciated: https://www.wisdom.weizmann.ac.il/~harel/SCANNED.PAPERS/Statecharts.pdf https://www.wisdom.weizmann.ac.il/~harel/SCANNED.PAPERS/Stat...
- drhodes 4y agoHere's a one that tracks the state of a button with mouse interactions https://web.stanford.edu/class/archive/cs/cs103/cs103.1142/button-fsm/ https://web.stanford.edu/class/archive/cs/cs103/cs103.1142/b...
- db48x 4y agoI think the simplest one I ever did was basically a reimplementation of setTimeout in Javascript. It was really only intended as a demonstration, because of course setTimeout is right there, but with only a very slight extension you can save the time you’re supposed to activate to permanent storage so that you can set long timeouts (hours or days) and they still fire correctly if the user leaves the page and returns later. And the code is clear and obviously correct, and now the reader has some idea of how to use the code to create more interesting state machines.
- mattgreenrocks 4y agoState machine diagrams illuminate system semantics without code: “when an API returns 403, go to REQUEST_AUTH state.” The transitions/states can then be observed by outside code to trigger UI/side effects. Done correctly, you can disentangle the decision-making code from the side effecting code to maximize reasoning ability. My favorite example of this is the following write up: https://gist.github.com/andymatuschak/d5f0a8730ad601bcccae97e8398e25b2 https://gist.github.com/andymatuschak/d5f0a8730ad601bcccae97...