Enterprise Architecture – Should I Use a Workflow Engine?

Architectureenterprise-architectureframeworksPHPworkflows

I need to add some new features to a PHP application. It is to follow the steps of a order. A process create some orders, the order goes to confirmation, then if approved is sent to a provider, later the provider confirm that can deliver the order, a request is made to the provider and so on…

I need to register when every step is made and send notifications. Also, some steps have a estimate time, and if that time is elapsed I need to send notifications so everybody know about the delay.

When a process starts, it have a predefined set of steps, but in a middle the user should be able to create new sub-steps, and delete or skip future steps..

Should I use a workflow engine? Which one do you suggests (free-opensource only)?

Best Answer

You've outlined some requirements which are typically catered for by workflow engines, such as following some process, task allocation, escalations and notifications. From this point of view, it would make a lot of sense to go with an actual workflow engine. There are two areas which make me question whether it will actually prove to be beneficial to use one in your case:

  • Workflow engines can involve a significant investment of your time to learn. They also tend to complicate the environment in which your application runs. If your requirement is a "once-off", and you are unlikely to implement similar workflow-related features in the future, you might want to reconsider using one. E.g. I wouldn't use a full-blown document management system if all I wanted to do was upload an attachment on one screen, and something similar applies here. I would normally advise against "rolling your own", but in this case I'm not so hesitant; I have been faced with your exact requirements in the past, and chosen to write my own (due to insane deadlines, don't ask) - it was a resounding success.
  • Your requirement about the user modifying the process, I have several issues with. Firstly, it's the kind of wishy-washy requirement that will grow in time. "Oh, we forgot, the user needs to specify who is going to action that extra step. Oh yeah, it can be someone outside of the company. Oh yeah, they need to be able to specify that at least 2 of the 5 targeted managers must approve", etc. Also, workflows can be complex beasts, and it's usually difficult to allow an actual user to modify them without breaking them, and to do so in a way which is quick and intuitive to the user. Beyond that, many workflow engines will not easily allow the dynamic modification of the process, so you may be limited to some kind of fixed logic like: "repeat this generic step until we run out of user-defined steps". My experience lies outside of open-source engines, but this would have been a difficult requirement to implement in the 3 or 4 proprietary ones I've worked with over the years.

To summarise, with the exception of the user-modifiability, your requirements are a pretty good match for a workflow engine. My suggestion: figure out whether there's an engine out there which gives you everything that you need (perhaps someone else can suggest specifics), and do some R&D with it. You will then be in a better position to weigh up your options.

EDIT: Sorry, my connection went down as I made that post, and seems to have been truncated. I've recovered it now.

Related Topic