Workflow Engines: Why use them

Basically, as a programmer when you are presented with a certain tasks, you have about a 100 ways to accomplish them. The path you take to solving the problem depends on so many factors. One i think is quite obvious is your experience with certain tools. In a programmers “toolbox”, one tool that shouldn’t be missing is a Workflow Engine.

What is a Workflow Engine?
Simply put, a workflow engine is an app that helps define a workflow process, the constraining rules guiding the decisions in the process flow and the information to be passed along in the process timeline.
Lets take a Cash withdrawal (from the teller machine) process as a typical example. The process can be defined into the following steps:

  1. Accept Card
  2. Enter Valid Pin
  3. Select Action: Withdrawal
  4. Select Account Type
  5. Enter Amount
  6. Check if valid pin, if yes, goto step 7, else goto step 1
  7. Check if valid account type, if yes, goto step 8 else goto step 1
  8. Check if available balance > amount to be withdrawn, if yes, goto step 9, else return to step 1
  9. Dispense Cash
  10. Eject Card

Above is a fuzzy 10 step to cash withdrawal on an ATM machine, sure its actually longer as i am sure the process has more rules attached to it, but for the sake of illustration, lets go with this.
Let’s say you decide to write a program implementing the above process logic and steps. Sure it’s good enough, but there are some backdrops to it, which are:

  • Any change request that comes in, you would have to go to your Source Code and make changes to your numerous “If statements”
  • This program isn’t reusable for another Bank ATM as process requirements may differ
  • You can’t train your users to make changes to the workflow predefined, as they are not programmers
  • There is no clear separation between your code base and rule base
  • Complex rule wouldn’t be easily represented in your code as it would require too many nested conditional statements
  • Visualization of the active workflow is not possible at any point in time
  • Triggers cannot be set except they are explicitly written in code.
  • Different time and event based event has to explicitly scheduled in code.

With the problems highlighted above, we can both quite agree that, writing a process driven program from zero to scratch can be quite tedious and complicated.
This is where the workflow engine comes in. With a workflow engine, you can define your process flow diagrammatically as you would an actual workflow and “strap” it to you code.
With a workflow engine, you can define users and user groups associated with a particular stage in your process flow, you can define due date for tasks in the flow and events to be triggered when due dates have been reached. If the processes involve user notification, you can define emails that would be triggered on the flow reaching a predefined stage. Quite better is the fact that you can define placeholders in the email that can be replaced with actual data being passed along in the flow.
With workflow engines, truly, there is freedom.
Trained users have access to modify the process flow as it is diagrammatically represent, and upon any modification, they can easily redeploy the workflow; without any single change to the code.
Effective tracking of current stage of the process, who has claimed, who has taken actions, what action was taken can be effectively tracked using a workflow engine.
Development time is quite faster as the lines of code written is significantly reduced.

What languages support workflow engines?
Popular languages that have workflow engines: Java, .Net based languages (C#, Vb), PHP.

What available workflow engines are there?
Popular Workflow Engines and BPM Products that have workflow engine components out there include:

Further Reading
Stack Overflow