MSDN Magazine - February 2008 - (Page 101) Keith Pijanowski WF Building State Machines With Windows Workflow Foundation he Microsoft® .NET Framework 3.0 introduced new capabilities for visually and declaratively building workflows that can be hosted by managed code. Out of the box, the .NET Framework 3.0 allows developers to build both sequential workflows and state machine workflows. Much has been written about sequential workflows because they closely resemble conventional programming techniques. State machine workflows, on the other hand, represent a different way of thinking about program logic. When designed and implemented correctly, they are just as valuable as sequential workflows. Furthermore, this style of workflow is a good starting point for building human workflows. Consequently, state machine workflows should be a part of every architect’s and developer’s skill set. machine workflow is that the requirements describe data or logic as moving in discreet steps (or states) from some starting point to some ending point. Take a look below at the description of a supply fulfillment business process that could be implemented as a state machine. 1. Employees fulfilling customer orders may need additional supplies to fulfill an order. Requests for additional supplies should be submitted to a central system for processing. HOW-TO This article uses the following technologies: Windows Workflow Foundation, Visual Studio This article discusses: Sequential workflows vs. state machine workflows When to use state machine workflows ✥ Building and designing state machine workflows ✥ Raising events to running workflows ✥ Passing data to running workflows ✥ ✥ State Machine Theory Business logic that is implemented as a state machine workflow follows a very different path than business logic implemented as a sequential workflow. Rather than flowing from activity to activity like a sequential workflow, state machines transition from state to state. Think of a state as a well-known step, stage, or even a status within a business process. States are useful because they indicate how much of a workflow has completed and how much must still occur. This lends itself very well to workflows that are long running. A good indication that a business process is suited for a state Code download available at: msdn.microsoft.com/msdnmag/code08.aspx Keith Pijanowski is a Platform Strategy Advisor for the Microsoft Developer and Platform Evangelism team, helping customers apply new ideas and new technologies to business problems. Keith is also a frequent speaker at Microsoft events in the New Jersey and New York area. You can reach him at www.KeithPij.com. february2008 101 http://msdn.microsoft.com/msdnmag/code08.aspx http://www.KeithPij.com
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.