News for hackers. Stuff that matters.
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.