Windows WorkFlow Foundation: The Next Step and Beyond, Page 2
Tools to Work with WorkFlows
To furnish users the capabilities to create activities and link them together, Microsoft has created tools for different proficiency levels. For developers with knowledge of any of the .NET languages, Visual Studio 2005 is the tool of choice. For less-technically skilled users who still need to assemble some kind of workflow, there are special tools available, for example, SharePoint Designer, formerly known as FrontPage, that permits building workflows for SharePoint 2007 with constraints in the use of advanced properties. At the user level, customers of standard Microsoft software have the possibility of applying prefabricated workflows in documents (Office 2007) in collaboration with SharePoint 2007; in this case, the workflow can be initialized from an Office application (Word, for example), and handled by the workflow engine embedded inside SharePoint. Another Office 2007 application, InfoPath, has the capabilities to bind elements to a workflow.
Because Visual Studio is the tool for developers of Microsoft software, the WorkFlow Foundation installation setup also provides the necessary Visual Studio 2005 add-ins to design and program workflow. Additional project templates are ready for use after installation (Sequential and State Machine WorkFlow Libraries, WorkFlow Activity Library, WorkFlow, and State Machine Console Applications) and a new Library of Tools with the provided preprogrammed Activities is available.
Click here for a larger image.
Figure 2: Visual Studio 2005 .NET WorkFlow Designer
As shown in Figure 2, a workflow is described by dragging and dropping Activities from the toolbox and visually linking them together. As with other applications developed with Visual Studio, the Activities have associated code, and clicking on the shape of the Activity will open the code-behind page where custom code can be written in C# or Visual Basic (See Figure 3). The visual design and the code are permanently linked and any change in one will reflect back in the other automatically.
Figure 3: Visual Studio 2005 .NET WorkFlow code-behind
The definition of the WorkFlow in the Visual Studio designer is saved in an XOML file, an XML file that can be edited manually using any ASCII editor (Notepad, for example).
The complete Visual Studio developers experience is present to work with workflows: smart tags alert users that elements are not properly configured, IntelliSense, code completion, and so on. Complete support for debugging, breakpoints, stepping into and out, call-stack, and attaching are available. When the code design and code are completed, the developer can built the project and, depending on the kind of host, the result will be a managed FrameWork 2.0 assembly that can be interpreted by Windows.
The Visual Studio designer for WorkFlow can also be completely re-hosted outside of Visual Studio .NET and then be hosted in a custom application. This affords the possibility of creating specialized activities packages to provide customers the option to built and modify workflows. Because the definition of the workflow is only an XML file, it also is possible to create and modify workflows programmatically and compile them with the command-line .NET compiler wfc.exe. This opens intriguing new scenarios for building artificial intelligence or adaptive workflows or even workflows that can build their own workflows or modify themselves on the fly.
The Windows WorkFlow Foundation runtime and workflows require full trust to execute in the Windows context. Because of this, the developers and administrators must bear in mind that all custom Activities need to be extensively tested before incorporation into a workflow and be aware that exception handling is very important (exceptions not handled by the workflow should result in workflow termination) and that authorization changes made by a workflow can be a security vulnerability for the system.
The Windows WorkFlow Foundation is the Microsoft model to abstract process oriented applications in a visual and algorithm centric way, linking the individual processes and activities that need to happen in a particular time frame and order. In a traditional approach, this flow of events would be programmed in the business or logical layer of the application, in the same way that other software pieces are coded; with the Foundation and its process abstraction, the workflow can be handled in a reusable, controlled way, supplying a more suitable and logical framework. To built and deploy workflows, Microsoft provides a complete developmental environment, but also grants the possibility of using less sophisticated tools, leading the way to construct the workflows programmatically.
About the Author
Gustavo Velez is an MCSD Senior Application Developer for Winvision (http://www.winvision.nl), a Microsoft Gold Partner in the Netherlands, with many years experience in developing Windows and Office applications, and more than three years of daily programming experience with SharePoint. He is also Webmaster of http://www.gavd.net/servers, the only Spanish-language dedicated SharePoint site.
Page 2 of 2