Yup. We're beating this state machine to death. I just wrote some preliminary code to graph the state machines. Because we now have stack tracing, I can probably trace out the actual path followed on the graph. Cool, cool, cool :)
Re:Wow...
Ovid on 2004-12-18T18:19:27
Part of the issue with any state machine is that the criteria can be confusing to an outsider if they don't know the business rules. In this case, the state machine tracks some of the dependencies for setting up Bricolage on PostgreSQL. The "root user" state simply means "if we have the Postgres root user, we can install. If not, check to see if we have a normal user and, if so, check to see if they can do everything necessary for the install. When I was using a bunch of nested if/else statements, it was turning into a bear and becoming far too complicated. In the process of turning into a state machine, the path I was taking turned out to be too complicated and just having a graph allowed me to simplify the design quite a bit, though the original graph was done in OmniGraffle.
I might add that it's all based on Leon Brocard's excellent GraphViz module. I'll probably wind up giving access to most of the GraphViz settings to the state machine user.
Re:permissions check
Ovid on 2004-12-20T04:49:39
It was code in progress. I had a dummy "never fail" state set up while I was figuring out the best way to proceed.