Take the 2-minute tour ×

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.

share|improve this question

closed as primarily opinion-based by bmargulies, Raedwald, Wayne Conrad, Andy, Sergey K. Apr 1 at 15:41


Looks like a job for Windows Workflows. msdn.microsoft.com/library/dd489465%28VS.100%29.aspx –  Mau Jun 29 '10 at 14:30
Maybe you should flesh out the specs before you begin development. –  corsiKa Jun 29 '10 at 14:31
Typically development starts upon receiving specs, but the developers don't know if they are good or not before they pretty close to the end of it. –  quantumSoup Jun 29 '10 at 14:36
add comment

1 Answer

up vote 0 down vote accepted

My PHP skills are all rusty, and I didn't get your question exactly, but I think it would be better if, rather than creating a finite state machine, you create a workflow structure/tree/graph as a separate object, and associate a project with a certain state in that structure. That way your workflows becomes really extensible. For example, you can add a new state to the structure, between two existing states say, without having to change anything else.

share|improve this answer
Yes, I have it set up like that. The state stored in the project just references a state defined in the StateMachine class. And all transitions are also handled by the StateMachine class. –  quantumSoup Jun 29 '10 at 18:05
add comment
