Tuesday, October 03, 2006

"State Machine Workflows in Windows Workflow Foundation"

MSDN Belgium - State Machine Workflows in Windows Workflow Foundation

"Windows Workflow Foundation allows us to implement workflows as state machines. This article uses a simple case and demonstrates how to develop a state machine workflow and solve the requirements of a case.

...

What is a State Machine Workflow?

A workflow is a defined process consisting out of several steps which implement the needed behavior. There are basically two kinds of workflows: sequential workflows and state machine workflows. In sequential workflows all decisions to progress in the workflow are taken by the workflow itself. There’s a well defined start and well defined end. Between there’s a flow consisting of branches and loops to direct the flow. This means the workflow is in control.

With state machine workflows there’s no real predefined path of all steps to undertake for a certain solution. State machines take another approach. They wait for events to happen and based on these events they change their state. State machines are used when the decisions are coming in from an external application and are unpredictable. So especially when there’s user interaction needed a state machine is a more convenient solution.
When new requirements come up, state machines are more flexible to add features. Mostly it’s a matter of adding another state. The state machine is not in control of the flow, but only controls the set of choices which can be issued by another application.

As state machines are a rather unknown concept, we’re going to build a simple but recognizable situation in this article.

..."

Now that .Net 3 is getting close to RTM, I'm going to be taking another look at WF. Also I'm taking a Developmentor course on WF ("Essential Windows Workflow Foundation for C# Developers" sigh, no VB version is available... good thing I my brain's runtime C# translation bit is flipped  ;) later this month, so I'm keyed to to WF related articles...

The above article's example also attracted me. It is a little more relatable than many, focusing on a TV state machine (TV is on, off, nothing interesting is on, cable is down, etc).

No comments: