> Transitions = factorial(state). In best case if they don't confuse states and transitions (wich is common) you'll end up with a spaghetti code where goto are replaced with callbacks on events.
Hey could you expand on this? I don't understand what you mean by transitions = factorial(state) and why this leads to spaghetti code when you confuse state and transitions.
Re:Ask HN: Event loop vs. Threads
by ObnoxiousJul on Monday May 28, 2012 @11:49AM
(#4033849)
In a state/transition model states are the node of an oriented graph .
When you reach a state you have a well defined condition (ex connexion established).
If you have an oriented graph with N nodes, and the possibility to boucle up on yourself, than you may compute the number of available paths, (edges, transitions, ...) according to this it is [ N possibilties X N possibilieties ].
So I may have a little over stated the number of transitions. :/ (what an idiot)
* 7 states <=> 49 possible transitions, * 8 states <=> 64 possible transitions.
Possibilities are increasing in a more than polynomial way, with a brain that can remember at most 7 items in memory.
A good example of a state transition diagram is in section 7.2.2 http://www.ietf.org/rfc/rfc3720.txt
Soz, for miscalculating.
Executive note : - if event model : have all state transition models DOCUMENTED ; - if multi-threading : once you have shared a context (config), uncouple all the data passed to your thread (and handle a SIGHUP to reload the conf safely).
Event model done wrong will cry havoc on your code maintability the same as multitreading done wrong.