I'm investigating the how best to develop/code a flow-chart like scenario.
For example, given the following diagram I could write the pseudo-code beneath it to satisy the requirements. However, as the flow chart changes, this would become difficult to maintain. Also, there's a fair amount of duplication which, again, would only get worse when the flow-chart becomes more complex.
Is the problem I'm trying to solve exactly what Windows Workflow foundation is for? Or would that be too heavy-handed an approach for the task at hand?
Perhaps there is an obvious solution I'm overlooking? Thanks for your help!
(P.S. I should mention that I'm looking for a .NET based solution)
..and the pseudo code...
Public Function Inbox() as Result
If IsItImportant() Then
If IsItUrgent() Then
If IsItBestUseOfMyTime() Then
If WillItTakeMoreThan15Mins() Then
Return Result.ProjectList
Else
If CanDoItNow() Then
Return Result.Now
Else
If DoesItHaveDeadline() Then
Return Result.Calendar
Else
Return Result.NextAction
End If
End If
End If
Else
Return Result.Delegate
End If
Else
If IsItActionable() Then
If IsItBestUseOfMyTime() Then
If WillItTakeMoreThan15Mins() Then
Return Result.ProjectList
Else
If CanDoItNow() Then
Return Result.Now
Else
If DoesItHaveDeadline() Then
Return Result.Calendar
Else
Return Result.NextAction
End If
End If
End If
Else
Return Result.Delegate
End If
Else
If IsItReferenceMaterial() Then
Return Result.File
Else
Return Result.Trash
End If
End If
End If
Else
If IsItWant() Then
Return Result.Someday
Else
Return Result.Trash
End If
End If
End Function
This does seem like a very good fit for WF4. WF4 is much lighter than you'd expect. I've got relatively complex workflows containing custom activities that execute in milliseconds. Also, its very easy to create custom activities that make creating workflows easier. And the design surface being WPF makes creating custom designers a breeze.