Wednesday, October 19, 2011

Impossible matches and conflict detection in Guvnor decision tables

The guided decision tables in Guvnor 5.4 will have a new button Analyze. This will help you detect mistakes in your decision table. Currently we already detect 2 types of problems:
  • Impossible matches
  • Conflicting matches (conflict detection)
Impossible matches

Here is a decision table to charge traffic violators a fee depending on their age and whether or not it is their first offense:

When will row 2 match? How can someone be at least 21 years old but at maximum 20 years old?

Never of course. That's an impossible match. Click on the button Analyze and Guvnor will detect this problem for you:


Conflict detection

Here we have the same decision table, with different values.
What fee does a 67 your old need to pay if it's his first offense? 200 according to row 2 or 100 according to row 3?

Both rows apply: they are in conflict. That's a conflicting match. Click on the button Analyze and Guvnor will detect this problem for you:

Notice that row 4 applies to any age, yet it does not conflict with any of the other rows. That's because it only applies if it's not his/her first offense and the other rows only apply if it is.

Here's a video: