The Quiet Battle for Decision Tables
Blog: Method & Style (Bruce Silver)
Decision logic can take many forms: constraint rules, if-then rules, decision trees, decision tables, and more. Over the years, decision management vendors have gradually allowed decision tables to nudge the other forms aside, for a number of reasons. Decision tables are easy for business people to understand. Their logic is declarative, meaning there is no prescribed order of evaluation. They can be analyzed, either by visual inspection or software, for completeness and consistency, meaning every combination of input values generates a consistent outcome regardless of the order of evaluation. Moreover, normalization principles analogous to those of the relational model in database design can be applied to decision tables, eliminating unnecessary rules or unnecessary inputs in selected rules.
These benefits, however, come at a price. They impose constraints on what can be put in a decision table cell. In the case of DMN, these constraints are called unary tests. They do not allow condition cells to contain functions or complex expressions or reference other variables at all, other than by simple equality or inequality. And this in turn limits the kind of logic possible in a decision table. In DMN 1.0, this was a conscious choice. It enabled all those benefits I just mentioned. After all, decision tables are not the only form of decision logic, and the others are able to use the full power of the FEEL expression language, so there is no practical limitation on DMN’s decision logic. I wasn’t on the task force back then, but actually I am surprised that the unary tests constraint was able to pass. I’m not sure it could pass today, and in fact there is a movement afoot from some members to effectively discard it.
To a number of decision modeling tool vendors, DMN just means DRDs and decision tables. They have no interest in FEEL, BKMs, contexts, or XML serialization – all the things that make DMN a true standard. If their tool can create something that looks more or less like a DRD and some kind of decision table, that’s good enough to call it DMN. I am hopeful that the DMN TCK will one day convince the marketplace that this is insufficient, but that is for the future. The issue right now is that for those vendors, decision tables are their only form of decision logic, and they cannot live with the unary test constraint. It’s true that if you allow functions and variables and arbitrary FEEL expressions inside a condition cell, decision table logic can be much more powerful. But it means you can no longer test for completness, consistency, and normalization violations.
This is one of the issues under discussion now for DMN 1.2, which is due for summer of 2018. There is some merit to it, but on balance I am opposed, because it would eliminate the powerful static analysis possible with decision tables constrained to unary tests. And here is an interesting fact: The DMN spec does not require a decision table to be complete or declarative, or to contain the minimum number of rules, or to conform to first, second, or third normal forms. While those things are considered best practice by decision table experts, they are all considered to be matters of “method and style” by the DMN spec. Violating them does not prevent execution, but it does make the logic harder to understand and maintain.
So my DMN Method and Style Basics training spends some time explaining these issues, how to recognize problems like gaps in the rules, hit policy errors, subsumption, rule masking, and normal form violations, and how to fix them. Some of these “style errors” are easy to make by mistake and hard to detect by eye, so Method and Style Decision Table Analysis is built right into the Trisotech DMN Modeler. In one click, the tool warns you of these problems and suggests how to fix them. In the diagram below, the decision table for Loan Approval contains a gap, hit policy violation, and subsumption (rules could be combined). Click Method and Style Decision Table Analysis, and the Log Viewer lists the problems.
If you’re interested in how to use decision tables in DMN, the DMN Method and Style Basics training is available now as on-demand eLearning, including 60-day use of the Trisotech DMN Modeler and post-class certification. Click here for more information and registration details. You can sample the training for free, including hands-on with the tool, simply by registering at www.trisotech.com/MethodandStyleTrial. That gets you an eval login to the software, and the free eLearning is accessible from the Learning menu.