Friday, December 01, 2006

New visual rule builder (Michael Neale)

I have been beaving away on a new UI/rule modeller specifically for the web (well, at least the web initially, hopefully we will also do it stand alone in the plug in soon).

This came about for 2 reasons:
1) DSLs have proven to be quite popular, and we want to make them available on the web (essentually a very handy templating tool for capturing rule data), and
2) I thought it would be nice to have a helpful and user friendly UI to "coach" people in authoring optimal rules (developers can also look at the drl output, see what makes it tick !).
(and 3: I had some spare brain cycles during JBoss world to work on it! and I thought the above 2 aims could be combined).

Since a picture is worth a thousand words, here is a screenshot:

This should be available in the up coming rule repository user interface. Visually its still quite rough, but its getting there, and the model behind it is solid. I would appreciate any feedback on how to make this a more "intuitive" interface to use (and don't confuse it with decision tables or scorecards, thats another beastie, this is just for a single rule at a time management).

I am integrating this with the (previously seen) dsl-aware business rule editor, as it is a nice fit (some people will use DSLs exclusively to hide details, others may use the modeller exclusively, perhaps a mix - yet more may prever vanilla drl, or a mixture in a package).

One of the nice things about it is that it requires little/no configuration (whereas there is some skill to configuring a dsl - this editor is driven off the model: facts/fields define what operators are relevant etc) - of course a dsl based rule reads naturally, but it is also easy to understand what the rule is doing visually if the model matches the domain. (A future fun little task will be to generate read only statements of the rules - a la the rule builder for email clients for filtering out that pesky spam).

So hows it work: A thats a trade secret ! Oh wait, no its not, its already in the SVN repository probably being crawled all over by google as we speak ! (oh my embarrasing code !). It works as it knows about the facts (model) available to the rules, what operators are applicable, bound variables, and has a limited set of actions it can take (mostly asserting fact, retracting, modifying fields, globals etc - I may add more as needed, but DSLs can template more things as needed).

I am planning to make the operator names/conditional element names configurable (they will have prettier defaults then this, I just ran out of time to do that, the idea is that anyone understanding basic logic should be able to use this, and if they know first order logic, all the better !).

It also has some basic validation (for instance you can't remove a fact that is needed in an action) - lots more can be done with validation to ensure correct rules at the time of entry (rule analysis module is another, seperate topic and a hobby of mine !)

Enjoy !