Pages

Monday, 8 April 2013

Basics of Windows Workflow Foundation (WF)

Basics of Windows Workflow Foundation (WF)
 
In this tutorial on windows workflow foundation, we will learn some basic concepts of WF like why to use window workflow foundation, what is workflow and activity, types of workflow like sequential workflow and state machine workflow and their uses. These are the basic concepts of WF which are asked in any .net technical interview. Lets have a look upon them. 
 
1. Why do we need Windows Workflow Foundation (WF)?
 
WF can be used in following two scenarios:
 
1. When business logic changes frequently
 
When the business requirements are changing frequently, you can use WF. Suppose you have developed an application for many end users. But each end user needs little bit customization on his end, then instead of changing code for each customer, you can simply use WF to change the logic.
 
WF allows a scenario where business logic inplemented as a workflow model or as a set of rules can be changed while the application is executing. No redeployment of .NET assemblies or recompilation is required. This leads to a software design where a central repository of business logic is possible that can be edited as part of normal work processes.
 
2. WF provides visibility into the workflow model
 
You can view a workflow model in the workflow designer, and you can print it out or take a copy of the image for inclusion in a functional specification. This can be valuable in explaining the software to non-developers or it could be useful documentation for when a software design needs to be learned by others and modified later.
 
2. What is Workflow and Activity?
 
A Workflow is a set of activities. Workflow model can be written in pure .NET code, pure XAML or Mix of XAML and .NET code.
 
3. What are different types of Workflow in Windows Workflow foundation?
 
There are two basics type of workflow: Sequential Workflow and State machines workflow
 
A sequential workflow has clear start and finish boundaries. In sequential execution, one task is executed after other. Sequential workflow has a determistic nature.
 
A State machine workflow is more dynamic in nature. Workflow has states and the state waits for events to help it move to next state. In State machine execution path is undetermestic nature.
 
4. When should we use a sequential workflow and when should we use state machines?
 
If the workflow is very rigid then you go for sequential workflow and if the workflow is dynamic then go for State machine workflow.
 
For instance you have placed an order and the order will not pass until your supervisor approves is a rigid flow. Because your order has to be approved by, a supervisor or else it will not be approved.
 
But what if your order moves from one place to other place. For instance, it moves from approval to waiting and then clarification a state machine workflow model is more appropriate.

No comments:

Post a Comment

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.