views:

304

answers:

4

I am responsible for a team of developers who will are about to start development of a light weight insurance claims system. The system involves a lot of manual tasks and business workflows and we are looking at using Windows Workflow (.NET 4.0).

An example of the business domain is as follows: A policy holder calls the contact centre to lodge a claim. This “event” fires two sub tasks which are manually actioned in parallel and may take a lengthy time to complete;

  1. Check customer for fraud – A manual process whereby an operator calls various credit companies to check and assess the potential of a fraudulent customer. From here the sub task can enter a number of sub-statuses (Check in progress, Failed Reference Check, Passed Reference Check, etc)
  2. Send item to repairs centre – A manual process where the item for which the policy holder lodged the claim is sent the repairs centre to be fixed. From here the sub task can enter a number of sub-statuses (Awaiting Repair, In Progress, Repaired, Posted, etc). The claim can only proceed once the status of each sub task has reached a predefined status (based on the business rules).

On the surface it seems that Workflow is indeed the best technology choice; however I do have a few concerns in using WF 4.0.

  1. Skill set – Looking at the average developer skill set I do not see many developers who understand or know Workflow.
  2. Maintainability – There seems to be little support within the community for WF 4.0 projects and this coupled with the lack of skill set raise concerns around maintainability.
  3. Barrier to entry – I have a feeling that Windows Workflow has a steep learning curve and it’s not always that easy to pick up.
  4. New product – As Workflow has been completely rewritten for .NET 4.0 I see the product as a first generation product and may not have the necessary stability.
  5. Reputation – Pervious versions of Workflow were not well received, considered difficult to develop with and resulted in poor business uptake.

So my question is should we use Windows Workflow (WF) 4.0 for this situation or is there an alternative technology (I.E., Simple State Machine, etc) or even a better workflow engine to use?

+3  A: 

I have come to this dilemma couple of times and I had chosen not to use Work Flow foundation. Some of considerations (similar to yours) were

  1. Involved work flows were lot simpler (a combination of state machine and sequential actions) and doing it in WF seems to overkill for efforts involved.
  2. Learning curve for developers to understand and to use WF effectively was considered high. Status transition table describing valid transitions and actions to be taken are used for additional flexibility and developers were comfortable with it, easily understanding the concept and purpose.
  3. Chances of business process changes were slim and rudimentary changes were easily possible with help of transition table. A change in transition would mean a database script while change in actions would result in new release/patch. However, probability of such occurrence was deemed to be low.

Looking back after 13-14 months, I still think that decision of not using WF was correct. IMO, WF makes sense where there is strong likely hood that work flow can change and/or business rules can change. WF allows to isolate workflow in separate file and so making it configurable by users will be simpler.

VinayC
+1  A: 

I did three projects in WF 3.5 and I have to say it is not easy. It force you to think in the whole new way especially when persistance is used. Updating the application which contains hundreds of incomplete persisted workflow is challenging. Single breaking change in serialization crashes them all. Introducing multiple versions of the same library to support new and old running workflows is common. It was challenging.

I haven't tryed WF 4.0 yet but based on experience from BizTalk and WF 3.5 I think it will be similar.

Anyway the best approach you can take is to do Proof-of-Concept. Take single WF from your requirments and try to implment it in WF 4.0. You will spend some time with it but you will prove if you are able to do that in WF 4.0 and if there are any visible benefits.

If you decide to use WF 4.0 I insist that you check possibility to run WF as WCF service hosted in Windows AppFabric. AppFabric provides some out of the box functionality for hosting WFs.

Ladislav Mrnka
When I was contemplating using WF for state engine in my app, problem of persistence was always nagging. The very idea of serializabled WF for every open case was horrible for various reasons including versioning. So my outline was that whenever trigger happens, pick up the business entity, create fresh workflow and attach the entity to that workflow and then workflow would do the work based on designed state machine. Once completed, throw the workflow and saved the dirty business entity back into database. But of course, in the end, I decided not to use WF at all.
VinayC
I completely forgot about versioning - this alone could be a good enough reason NOT to use it.
Kane
@Kane, thats not necessarily true. You can always externalize your state. So instead of "deserializing a workflow and then resuming it", you will be creating a workflow instance, attaching the external state and then running the workflow. This can eliminate need to serialize and version workflow.
VinayC
+4  A: 

I have done several WF4 projects so lets see if I can add any useful info to the other answers.

From the description of your business problem it sounds like WF4 is a good match, so no problems there.

Regarding your concerns you are right. Basically WF4 is a new product and is laking some important features and has some rough edges. There is a learning curve, you do have to do some things differently. The main point is long running and serialization, which is something the average developer is not used to and requires some thought to get right as I hear far too often that people have problems serializing an entities framework data context.

Most of the time using workflow services hosted in IIS/WAS is the best route when doing these long running type of workflows. That makes solving the versioning problem not to hard either, just have the first message return the workflow version and make that a part of each subsequent message. Next put the WCF router in between that routes the message to the correct endpoint based on the version. The basic is never to change an existing workflow, always create a new one.

So what is my advise to you? Don't take a big gamble on a unknown, and for you unproven, piece of technology. Do a small, non critical, piece of the application using WF4. That way if it works you can expand on it but if it fails you can rip it out and replace it with more traditional .NET code. That way you get real experience with WF4 instead of having to base a decision on second hand information and you learn a new and powerful technology in the process. If possible take a course on WF4 as that will save you a lot of time in getting up to speed (shameless self plug here).

About the Simple State Machine. I have not used it but I was under the impression it was for short running, in memory, state machines. One of the main benefits of WF4 is the long running aspects.

Maurice
+2  A: 

We have been using WF 4.0 the last couple of months. I have to say it's challenging to think the Workflow way. However, I can tell you it's worth it. We knew very little when we started. We've bought a beginner and professional book for WF 4.0 that helped. I, myself, watched many videos online and followed PDC 2009 for their breaking news about WF 4.0 and how it's different from the previous somewhat sucky versions. One major thing that we had to propose a solution for is the way we can deal with In/Our Arguments in a workflow without bounding our custom activities to certain data types and how to pass parameters between activities. I have come up with a good solution for that, and the workflow experience that we have so far is not bad at all. Actually, we have a workflow-intensive application that is getting bigger and bigger and I really cannot imagine myself solving it in a different environment. I love the visual effect that it has: it keeps me away from the details of if/else etc constructs and makes the business rules apparent in a way that doesn't make you forced to dive into lines of code to know what's going on or how to fix some bug. By the way, the project that we worked on is very similar to what you described and it's a medium-sized project. You can tell from my words that I like it and I do recommend it although is incorporates some risks as it's a new technology and you have to come up with some innovative ideas.

my 2 cents...

Derar
@Derar, I would be interested in hearing about your solution for handling the passing of parameters between activities. I have been toying with WF on and off and this is one area that looks a little arkward to me, but that could just be my lack of understanding.
Chris Taylor
I think it's a place where they need to work on more. In any case, we use a big "global hashtable" repository where we add variables typecasted. The naming convention for these variables incorporates both their type, name and their parent activity. This really helped us in our implementation. I realize there might be better ways to do this, but this works really well and you can utilize it in different ways when you design the workflow. For example, GerCustomer activity might have a handful of input args and 2 out args: GetCustomer.str_customerID and GetCustomer.int_premium. Hope this helps..
Derar