What is WWF?
Workflow foundation is a new framework that came with .net 3.0. Microsoft released major frameworks in this release like Windows Presentation Foundation (New framework for writing windows application), Windows Communication Foundation (Very advanced framework for writing web services to make communication between systems in the internet, intranet.)
Using this new framework we can write reactive programming in a better way by writing declarative code. That means,
1. We can write the functionalities that does not need to be executed write after it is loading into the runtime, instead we can schedule when we want to execute that code.
2. Reactive programming is nothing but the execution of the application will be expecting external input. For example, if your application runs through different number of steps, and some step may need some input data that suppose to come from outside environment or some external entities. Those external entities may be human or it may be some other system. So, based on that resource availability, the input may not come at the expected time. But to move ahead on the application process, the outside entities input are must. So, we may need to wait for that input. If you are not using the Worflow foundation, you may be unnecessarily wasting the resource on the memory until you receive the input. But by using the windows worklflow foundation, you can solve this issue.
Why WWF? and Benefits
Since workflow foundation is always scheduled execution, if your application is having workflow process and you want to have better control on the flow execution, then workflow foundation will be better choice.
All your workflow logic will be placed into single location instead of writing them in all different places like .net code layers, stored procedures, views etc.
You can see your application logic in visual diagram which provides the self documentations. So, if any new employee joins your company, they can easily understand the business process flow and they can contribute on the productivity sooner.
Where should I use WWF?
Workflow foundation can be used to write application that needs Sequential workflow process. This can be written using “Sequential workflow”
For example, if you have an application to raise software request, then it has sequence of steps where the execution may move only in the forward direction. Never come back in the backward direction. It may have following sequence of steps
Software Request will be raised and sent for Managers approval
Manager needs to approve and send to Senior Manger Approval
Senior Manager needs to approve and send it to security team
Security team may needs to approve and send it to Admin team.
Admin team needs to process and provide access for the software and send an email notification to the employee.
In the mean time, employee should be able to see the current status of the request.
Workflow foundation can be used to right State based process execution. This can be written using “State machine” workflow
Best example for this state based execution is defect tracker (Bug tracker) where , you may create a ticked which will be in “New” status, then it will be assigned to developer in “Open” status. Then the developer fix the issue and assign in to tested for testing in “SystemTest” status. Now the tester may able to closed the ticket if the fix worked, otherwise tester may send the defect back to the developer in “Reopen” status.
Workflow foundation can be used for Wizard based application. Since the wizard needs to know what the next step is, what is the previous step and if it has to find the next based on the used input, so wwf would be better choice
If you want to understand how the Windows Workflow Architecture works, please take a look at the below links