News for hackers. Stuff that matters.
Re:Finite State Machines by reasonabl_human on Monday February 22, 2021 @09:31AM (#26224937)
Do you have any examples off the top of your head? Haven’t explored this domain
Re:Finite State Machines by pantulis on Monday February 22, 2021 @09:58AM (#26225235)
For example an ecommerce order tracking system with different status (in cart, paid, shipped, returned, so on). Spree solves it very elegantly, look at those "events", "transitions".

https://github.com/spree/spree/blob/4687e608b49236c2850500b0...

Also, Spree has this nice intro to FSMs

https://github.com/Humane-Documentation/Spree/blob/master/re...

Re:Finite State Machines by pantulis on Monday February 22, 2021 @10:02AM (#26225292)
I also happened to work in a very huge C++ project for the business logic component of a call center, using CORBA and the Reactor pattern from ACE to integrate different parts of the user / ACD / 1st agent / specialist / CTI combo.

But it was a telco project, so the "let's use a FSM" was well thought from the beginning. Turns out you could easily know what the system would do just by reading a huge Smartdraw document, and this also allowed for reasoning on new use case scenarios. It did not matter that the main file was a horrendous 40kLOC C++ class because the Smartdraw diagram was the documentation and everything else was just trivial code.

Re:Finite State Machines by slt2021 on Monday February 22, 2021 @09:35AM (#26224973)
Actor pattern (akka) is the distributed FSM
Re:Finite State Machines by nahuel0x on Monday February 22, 2021 @10:23AM (#26225538)
Not really, an actor can implement an FSM but it also can have an infinite number of states.
Re:Finite State Machines by slt2021 on Monday February 22, 2021 @02:42PM (#26229491)
every non deterministic SM can be converted into FSM: "Using the subset construction algorithm, each NFA can be translated to an equivalent DFA" https://en.wikipedia.org/wiki/Nondeterministic_finite_automa...
Re:Finite State Machines by gopiandcode on Monday February 22, 2021 @07:14PM (#26232384)
How is that relevant to the parent's point? Non-determinism has no relation to a system with infinite states, and the NFSM -> FSM construction algorithm provides no help in that case.