Workflow designMaking the business people happy
One of the primary reasons why businesses chose to use workflow engines is that they get pretty pictures that explain what is going on and look like they are easy to deal with. The truth is anything but that, but pretty sell.
My recommended solution for workflow has a lot going for it, if you are a developer. But if you’ll try to show a business analyst this code, they are likely to just throw their hands up in the air and give up. Where are the pretty pictures?
One of the main advantages of this kind of approach is that it is very rigid. You are handling things in the event handlers, registering the next step in the workflow, etc. All of which is very regimented. This is so for a reason. First, it make it very easy to look at the code and understand what is going on. Second, it allow us to process the code in additional ways.
Consider the following AST visitor, which operate over the same code.
This took me about twenty minutes to write, mostly to figure out the Graphviz notation. It take advantage of the fact that the structure of the code is predictable to generate the actual flow of actions from the code.
You get to use readable code and maintainable practices and show pretty pictures to the business people.
More posts in "Workflow design" series:
- (06 Mar 2019) Making the business people happy
- (05 Mar 2019) The thinking behind
- (28 Feb 2019) The long haul
- (27 Feb 2019) What you shouldn’t be looking for
Comments
wow, very nice! I was wondering how to extract metadata from the code in DSL and this is really powerful approach
Not really related to the topic of this series, but you can use a library to make generating Graphviz files from C# easier.
There is also a very nice C# library for state machines - Automatonymous in where you write code very similar to yours there. From what I remember it also has a rendered for generating those graphs. I wrote one as well once for some project - visitor pattern as well - and it was also quick. For the same reasons you state - it might be code, but the stricture is actually very rigid and clear.
Comment preview