I designing a project management tool, where you can track current status and such. Let's say a typical project flows like:
Create Project > Deliver Specs > Approve Specs > Start Development > End Development > Delivered (another flow from Deliver Specs could be > Reject Specs > Rework Specs > Re-deliver Specs)
There are many steps in between, but for simplicity I'll just leave it at that. Different user (groups) are allowed to do different tasks (ie: only developers can start dev or approve specs, the customer can create projects, etc.)
My initial design was that of a finite state machine, where you have states and each "task" is a transition taking the project to a different state. Ie:
[Dev Started] -> (End Development) -> [Dev Finished]
[Dev Finished] -> (Deliver SW) -> [SW Delivered]
[State] (Transition)
Some sample config code in PHP looks like:
$states = array (
0 => array('name' => 'Project Created', 'transitions' => array(0)),
1 => array('name' => 'Specs Delivered', 'transitions' => array(1, 2))
// ...
);
$transitions = array (
0 => array('name' => 'Deliver Specs', 'allowed_groups' => 'customer', 'next' => 1)) // ...
);
Now, that is kind of OK, but a developer typically doesn't approve the Specs are until they are towards the end of development. To get around that, I created duplicates of states, which "remember" whether the specs have been approved or not. Add to that user/group permissions and other stuff I have to keep track of, this is quickly becoming unwieldy.
Most projects can be fit into a relatively small number of "flows" which will be somewhat similar, but I want the code to be flexibile and extensible enough to handle more.
Does anyone have a better idea? Thanks in advance.