11

I was wondering if anyone has successfully used Windows Workflow Foundation for a BusinessRules/Validation engine, or if you know of some sample code or articles about this.

If you have used it before, what do you think of it? How is it compared to other BusinessRule/Validation systems?

I am thinking of rules like

if (A, B, and C) 
    AllowAccess();

Or

if (Value between X and Y)
    return true;
Rachel
  • 23,979
  • 16
  • 91
  • 159

2 Answers2

6

I began building an engine using WWF WCF several months ago. I do not know how complex your rule base is, but ours was pretty large. When you have the potential for something like 40,000 branches, WWF is not a good fit. As an alternative, I ended up building an engine that used logic exception tables in SQL. The rows would store the basic values, as well as formatted strings for formulas that varied between exceptions. Combined with a dynamic language (I used an embedded ironpython engine with a wrapper and you could use an embedded JScript engine), the logic could be determined at a highly abstracted level on the fly. I am SO glad I went this route. Drag and drop logic seems great, but business people will never be able to use it, despite the marketing, and it will only slow a developer down IMHO, quickly becoming a rat's nest.

Update: If you're still interested, here is the beginner's guide. It is certainly not expansive, but has some decent videos. As to setup, our network engineers did the setup for me (company policy for server maintinence, security, etc.), but supposedly it was almost identical to setting up a basic WCF service. Basically throw it in a Virtual Directory in ISS. Because it’s a long-running process usually, be extra careful with memory management while writing the service. Not disposing some resource over and over again for 6 months will really add up and your server will not be happy.

Morgan Herlocker
  • 12,722
  • 8
  • 47
  • 78
  • How was it setup? Do you know of any articles online to begin with or that contain sample code? – Rachel May 06 '11 at 18:05
  • Thanks. How was the performance of executing the business rules? – Rachel May 06 '11 at 18:32
  • And quite honestly, I'm against the idea of using WWF for this, however my teammate is all for it so I would like to at least give it a chance :) – Rachel May 06 '11 at 18:33
  • 1
    @Rachel- performance was reasonable (fast enough to be runnable in a UI setting with a bit of multi-threading if that means anything). Its not insanely fast either, but nothing with a distributed WCF service is going to blazing either. – Morgan Herlocker May 06 '11 at 19:14
  • Is there still some material available on the Internet that demonstrates your logic engine and IronPython approach? (Your "beginner's guide" link no longer works). – Robert Harvey Jul 04 '17 at 19:06
1

I have to agree with ironcode. We wrote a drag-and-drop flowchart-style system a couple of years before the new Biztalk came out (strangely enough). The idea was that non-programmers could program and the system would be easily maintainable and changeable.

The result: you still needed 'business analysts' who needed to be as highly trained as a programmer would be, but in the new 'language' of the WWF system. So you didn't gain much at all there. The debugger was nowhere near as good as a true development system, so you lost there. You also needed programmers to write the tricky modules that were the core of the data and GUI processing. The scalability also died off very quickly. Simple business rules were easy to put together, but once you got past a dozen you were in spaghetti.

I think it had some benefits, but basically you'd be better off using a scripting engine to tie together custom-written modules.

It did look really cool to the marketing types though, made for a great demo :)

gbjbaanb
  • 48,354
  • 6
  • 102
  • 172