Workflow Foundation Learning - I DID IT!
Well, today (4th of September 2006, almost the independence day of my country) I decided to learn about Windows Workflow Foundation (quite the same day I started learning about Linq and ADO.Net vNext, actually). I'm aware I am late but it's been hard to study outside work, so as it is always the case I decided to bridge the opportunity of learning a new tech and doing some actual work that will help the company I work for (we smart devs huh?).
So I set on to the easy task of building a workflow application to orchestrate the dev shop I work in. The requirements of this application are:
- It has to enable our architects (senior developers) to change the way our shop works in a project-basis or customer-basis, so I'll probably load the workflows dynamically.
- The senior devs will create workflows (As of now I don't know if these will all be contained within the application or will be on a provider base - IoC).
- The administrator of the application will then be able to associate the projects or customers with the workflows.
- The workflows must have complete integration with our Team Foundation Server database as of this:
- Whenever a workitem changes it's state the workflow corresponding to the project it got changed will get notified via a webservice call (BisSubscribe, more on that later).
- If the change of state implies in workflow actions the workitem should be updated, and if needed new workitems or even workflows should be created.
- Whenever a workitem includes another workitems (i.e.: A Scenario that is composed of three minor scenarios), and all the minor ones get their workflows completed, the major one should get it's workflow completed as well (sort of a composition way).
- There has to be custom activities for the senior devs that enables them to: Create WorkItems, Update WorkItems and Change Workitems Status.
- There has to be an ASP.Net interface for our project managers to tell EXACTLY the status of a current development effort.
Ok, that's pretty much the requirements I'm aiming for. Yeah, you are right, that's a lot, I know...But I don't plan to accomplish all that in a single iteration. The requirements above would be abiding in Nirvana. And as we all know, that's a lot work to do, right? Wrong. With the right set of tools I plan to show that we can build a pretty cool application that delivers a lot of value with very small effort.
Ok, so first things first. I accounted for everything that I had complete knowledge of, everything I had a vague knowledge and everything else (The more I learn, the more I learn how little I know. -- Socrates).
So the pieces of technology I intend to use for this project are:
- Visual Studio 2005
- .Net 3.0 (.Net 2.0 + Windows Workflow Foundation + Windows Communication Foundation + Windows Presentation Foundation + Cardspaces)
- Windows Workflow Foundation
- Windows Communication Foundation
- Language-Integrated Query (LINQ) and ADO.Net vNext (Not sure as of now if I'm using this since the ADO.Net ctp is very raw as of now)
- Sql Server 2005 as the database backend
- Team Foundation Server as the source control management and workitem store
After enumerating the technologies I want to use I found out (miserably) that I didn't know at an expert level not a single one of the items above, except for Visual Studio 2005. Since The First Step is Admitting You Have A Problem, I'm on my way to changing the odds. So I enumerated the technologies I needed deeper knowledge of in rank of interest.
- Windows Workflow Foundation (Referred to as WF from here on)
- Windows Communication Foundation (Referred to as WCF from here on)
- LINQ and ADO.Net vNext (If i'm using them)
As of SQL Server 2005, even having a deep desire to learn more, I won't have to have a deep understanding of how it works since I'll most likely use a very nice abstraction layer on top of the database backend.
As of Team Foundation Server I'll probably be using some articles and blog posts spread on the web, since I'm quite advanced on this topic (I'm member of a CodePlex project code-named Vertigo that is a Source Code Version Tree Browser for TFS. It's really cool! Check it out here!).
I decide then to reread a very nice blog post Scott Guthrie made about WF (I blogged about it here). And it leaded me in some different directions.
First I heard a very nice, very informative and very fun DotNetRocks show with Michael Stiefel about Windows Workflow Foundation. If you havent heard it you definitely should. Michael is a very smart guy and his talk helped me in understanding the fundamentals behind WF. You can listen to the show here.
Then I decided to head for one of those "Get Started" articles, which to my good fortune, Scott just pointed me in the right direction. Bart De Smet blogged about a begginer's approach to WF in a very nice and informative manner at this article. Definitely worthwile.
So I go on and build my first HelloWorkFlow application. Boy, was I happy when the console showed those magic words every developer loves to see (I guess we are needy lol): "Hello World" (well, mine actually said: "Hello, Workflow!". I guess Bart thought it was more appropriate lol).
His article was so nice that I decided to go on reading his articles, and again Scott pointed me in the right direction by providing links to two parts of a great article called "WF - How to make a workflow dynamic?".
I started reading the first part of the article. This part of the article handled modifications from the inside of the workflow. What this means is ways to modify how activities are laid at runtime from within workflow code. Another great article by Bart De Smet, one that you can read here.
As of now I can say that WF is pretty extensible, which is really cool, since workflows tend to change a lot (at least until stabilization). So I head on to part two of the article. Yet another good article on WF. You can read it here.
One thing that still bugged me was how would I be able to access the Workflow from a webservice (creation and maintenance of flows). But again Bart De Smet is ahead of me with two great articles on WF - Exposing a workflow through a web service and WF - Exposing a workflow via WCF. Both really nice articles.
Last but not least, I watched the WebCast by Kashif Alam on "An Overview of ASP.Net and the Windows Workflow Foundation". You can watch it here. Definitely worthy since it kinda answered all the questions I still had on WF.
So now I know a lot more about Windows Workflow Foundation (16th of September 2006). The weird thing is that it keeps amazing me more and more. If you go to the Windows Workflow Foundation Resources Site you will find A LOT MORE RESOURCES on developing WF applications. Samples, Activities, Utilities, Papers, WebCasts, Talks... You name it on WF and it´s there.
This week I decided to turn the project on this article into a real open-source project using codeplex, and Microsoft kindly provided me with the project space in it. You can check out the project blog in Project BHAL Wiki. The project has evolved a lot since it´s conception, so I´ll stop the article here and create a multi-part article that will go along with the project evolution.
The next talk will be on writing custom activities and Microsoft´s Framework for doing so. Keep wired!
