What is Workflow, and why bother?


Workflow, of course, is one of those deeply overloaded terms that hinders communication as often as it helps, so I’d better say what I mean by it.


Workflow comes down to just two ideas: that there is work to do, which a workflow sees as opaque units of behavior; and flow, which describes what work gets done when.


So is this a Workflow?


public void HandleLoanRequest (string customerID, Application app)
{
    if (CheckCredit(customerId, app.Amount))
    {
        MakeOffer (customerId, app);
    }
}


Yes, I believe it is.  The work is checking the customer’s credit and making an offer – and HandleLoanRequest defines if and when this work is performed.


But the fact that workflow vendors have traditionally felt that something more than this sort of code is required before they declare victory suggests that we’re still missing a key notion.


This, I believe, is that we don’t just need to describe the flow, but describe it in a way that we can inspect, reason over, and manipulate.  In short, workflow needs a model.


C# is one way to do this – we can define coding standards that allow us to scan workflow code and draw a graph of the flow, for instance.  Or we could define attributes for the developer to use to call out the parts of his code that form the model.  This is not the choice that we made for the Windows Workflow Foundation – and I’ll talk about why we chose what we did in later posts – but it would work.


But back to why we might need a model.  We’re going to have to put in effort to create it, so why bother?  Where’s the payback? (or the beef, as this Englishman abroad is learning to call it).


Well, I think the payback comes from what the model enables –


Visualization  Useful for the developer, during both development and maintenance, but also for the workflow user who wants to know why they are supposed to be doing what they’ve been asked to do, or the IT Ops guy who wants to know what some misbehaving app is, or should be, up to.


Expressiveness  A workflow model is a Domain Specific Language, specialized to support characteristic problems.  An example is a review process where three positive votes out of five reviews mean that the document is good – and any outstanding reviews can be canceled.  This is a little tedious to code, but the Windows Workflow Foundation includes out-of-the-box constructions that address such problems.


Execution  The runtime can exploit the model to take away the need to solve the same problems over and over again.  In the Windows Workflow Foundation we built in support for the knotty problems of long running workflow such as state management and compensation – controlled by simple, expressive model elements.


Monitoring  The existence of a model makes it possible to produce an event stream with a meaningful semantic without any additional developer effort.  This can then be used to monitor instances of workflows, or aggregates.  Windows Workflow Foundation allows also allows declarative decoration of events with application data pulled from the workflow state – so that you can tell that credit check has started for order 14532.


Transformation  Models beget models.  An example is the transformation of a workflow model into the Message Exchange Pattern required to communicate with it – as Dharma and Don demonstrated so beautifully at the PDC.  Another is customization.  An ISV ships a workflow, which is customized by a VAR, and then again by a customer.  Then the ISV ships a new base version.  The use of a shared, well understood model for the workflow makes the consequent 3-way merges much more tractable.


Composition  If an application is factored into flow and work, then the atomic elements of work, with their well understood interfaces, can be reused by other workflows.  Workflows themselves are valid definitions of work that can also be used by other workflows. 


Customization and transformation together enable ecosystems where definitions of work and flow become shared or traded artifacts.


Manipulation  Often there are requirements to invent or modify workflows on the fly.  If this means changing code, then there are going to be problems with the security folks – even if the users understand how to hack it.  Using a model makes possible dynamic manipulation that is both controllable and comprehensible.  The Windows Workflow Foundation supports the dynamic modification of both workflow types and workflow instances.


So that’s it (or at least, all that seeps into my mind this Saturday afternoon).  That’s why we thought a model was a good idea, and why we think it has great ROI.  But if none of these benefits apply in your scenario, then really, coding is still very cool.


Comments (60)

  1. // TODO: learn it and use it…

    Some links

    Windows Workflow Foundation Site

    Introducing Windows…

  2. BigJimC says:

    Wow – been waiting for this for some time now from MS. Have tried and failed to get to grips with previous MS workflow offerings.

    Really pleased to hear right moves to integrate this with Sharepoint and will wait impatiently for this…

    Will be evaluating this against the architecture of other content managment systems using workflow.

    Keep up the great work.

  3. Good blog, great new foundation, glad to see your blogging at last!

  4. Rido says:

    Do you have information about how to UnitTests a workflow? There are any plans to integrate WinWF testing with VSTS?

  5. PatriotB says:

    At my previous job, the word "workflow" was at the center of everything. It got to the point where it deserved to be one of those "banished words". http://www.lssu.edu/banished/current.php

  6. Venky says:

    Hi,

    Nice and simple explanation about the Workflow. I have been exploring WWF for quite sometime. Could you please explain me where does WWF runtime sits at runtime and how does the WWF model built in the Design time relate to the actual application at runtime. They say that WWF does not have Process of its own, WWF runs inside the Host Application’s process space. I am very much confused with all this. Could you please explain me in details.

    Thanks,

    Venky

  7. GoCanucksGo says:

    I think it is also important to discuss when workflow might be overkill a bit too much of a good thing as Venky pointed out.  You can check out this article i came across at <a href="http://workflow.wordpress.com/page/2/">http://workflow.wordpress.com/page/2/</a&gt;

  8. Thanks!!! http://www.insurance-top.com/company/”>http://www.insurance-top.com/company/ car site insurance. [URL=http://www.insurance-top.com]home insurance[/URL]: auto insurance, insurance car, Best Insurance Web site
    . Also [url=http://www.insurance-top.com]cars insurance[/url] from website .

  9. Persone los pioneros non rabata. Great…

  10. lesbian rape says:

    Best of all people w can talk…

  11. john says:

    Great title!  Thanks for the overview.

  12. This site is very interesting. Good job =)

    <a href="http://tanklesswaterheater.storage9.com">Tankless water heater</a>

    <a href="http://tanklesswaterheater.bht0a.info">Tankless water heater</a>

  13. 49247 says:

    Hello, good site and interesting design!

    <a href=" http://xanaxsale.tdfsf.info/xanax-sales.html ">xanax sales</a>
    <a href=" http://xanaxsale.tdfsf.info/xanax-sales.html ">xanax sales</a>

    Thanks!

  14. Poll Pitt says:

    I am so [url=http://access.2surf.eu]lucky[/url] on having what I have! And good luck in yours [url=http://2access.2surf.eu]search[/url].

    Just visit [url=http://access.122mb.com]my site[/url].

  15. Nice article!

    But I was wondering what are the differences between WF and other Workflow technologies?

  16. Sach says:

    Is there any performance degradation with WWF over normal C# code. If so how much so? Would WWF be ideal for online system scenarios as well as offline?

  17. blade4246 says:

    Excellent write up, good work.

  18. Computer-Mag says:

    Nice and interesting article. Thanks for your great work.

  19. RS says:

    I found this information really helpful.

    Good work.

  20. Schai says:

    Verry good blog. Thanks for all the information.

  21. Hotel Ischia says:

    Good blog, great new foundation, glad to see your blogging at last!

  22. Webkatalog says:

    Nice and interesting article. Thanks for your great work.

  23. Wolle says:

    Hello Dave,

    all Your blogs are great. Thank You for so much work for us.

  24. Iris says:

    Thank you for your interesting blog.

  25. Webkatalog says:

    Nice and interesting article. Thanks for your great work.

  26. This site is very interesting.

  27. Klimatyzacje says:

    Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje Klimatyzacje

  28. Ischia says:

    Verry good blog. Thanks for all the information.

  29. lierac says:

    Very great and excellent article. It’s realy helpful. Thanks again.

  30. Anonymous says:

    Can you please clean up several SPAM messages in blog? SPAMS really irritate while reading blog.

  31. MisterFantastic says:

    Hi,

    This is really a nice article . I can understand the uses and advantages of the workflow easily .

    Thanks

  32. BPM software says:

    Good blog, sorry to see it is not active

  33. Wow – been waiting for this for some time now from MS. Have tried and failed to get to grips with previous MS workflow offerings.

  34. Very great article! Thanks for sharing! I’m looking forward for new postings!!

  35. mike says:

    Thanks for pointing out the advantages.

    some addisional info …. http://blog.bitlinkit.com/post/WorkFlow.aspx

  36. Marco says:

    This is really a nice article . I can understand the uses and advantages of the workflow easily .

    Thanks

    http://www.ischiahotelgrilli.com

  37. Ischia says:

    Hello Dave,

    all Your blogs are great. Thank You for so much work for us.

    http://www.ischiamobile.com

  38. Lutz says:

    great article. I like workflow!

    http://www.kfz-unfall-schaden.de

  39. strom says:

    Thank you for your interesting blog.

    http://www.mybest24.com