I've been reading about workflow designs a bit and I am confused on how to model my application. Any help is greatly appreciated!
Here's the requirement:
- Sequential workflow with 5 top level Activities
- Each top-level activity may contain 1 - 5 child activities.
- New child activities may be introduced in future.
- The input to the workflow is a document and its type. Based on the type of the document, it has to go through 1 or more child activities in each top level activity.
- All top level activities and a few child activities apply for all type of documents.
- About 5 different type of documents are known at present. A theoretical maximum of 10 more document types may be added in future.
- XAML will be used for workflow configuration.
- Framework: 3.5 SP1
For the above requirement, can you please advice what is the best strategy in terms of initial design and maintenance:
开发者_Go百科- Design one big workflow with lot of IfElse branches in each top level activity (the type of document will be checked in each branch or child activity)
OR
- Design separate workflows - one each per type of document.
OR
- Any other better alternative?
thanks!
I had worked in WF 3.5 SP1 for reasonable duration and would suggest the following:
Separate workflows - one each per type of document: A straight forward NO, since you have to be robust enough to incorporate new documents. You simply can't (shouldn't) put Document types count as constant. Business requirement would change and you would be asked to incorporate more then 10-15 documents (happens all the time in all real world software).
Since new child activities may be introduced in the future, you may look into defining separate workflows for the 5 top level activities. That might assist you in maintaining individual top-level activity.
One big workflow with lots of If-Else might sound and look good at the beginning but trust me it looks horrible once a reasonable number of conditions are added. It really takes a lot more effort to manage 1 gigantic workflow.
So, to sum up, you may divide your activities into 5 workflows for top level activities only and then manage the child activities inside them irrespective of the document type which is still passed as argument.
Hope it helps.
精彩评论