WF4 Sequence vs Flowchart
From my initial experimentation with WF4, it appears that the Flowchart can represent a workflow equally well as a Sequence flow, although the reverse is not necessarily true. If this is correct (and forgive me if I've missed something), is there any advantage at 开发者_C百科all to ever using a Sequence workflow?
From what I can tell, it would always be preferable to start with a Flowchart model as this offers more flexibility for future remodelling if required. If you start with a Sequence, you're never going to easily add flowchart-style branching/decisioning.
Does this sound like a sensible approach to take?
No it doesn't.
For one a flowchart is the most flexible but it doesn't directly support lots of capabilities like a Pick or Parallel structure. And with flexibility comes a price, it is more work to create a simple sequence if steps. And that is a quite common appearance.
Basically it would be saying that C# produces MSIL so everything you can do in C# can be done in MSIL but not everything you can do in MSIL can be done in C# thus you should program in MSIL only.
In fact the WF4 model makes it real easy to combine the different styles. You can start with a sequence, embed a flowchart, embed another sequence and a state machine in there. As far as the runtime and the designer is concerned they are just activities.
I commonly use FlowChart as my outer root and embed pieces of sequence in it for the various steps - the overall flow is easy to understand and the detail is hidden by the designer unless you drill into it
However, I wouldn't make a fetish of it - if the flow really is a sequence then it would be perverse not to use a sequence. And as Maurice says, you can always embed a piece of flowchart into the sequence if you need that at some point
精彩评论