Decision Tables, Part 1 ~ The Route to Consolidated Business Logic
As you scale up, effective means to visualize and manage entire sets of rules at a time becomes more and more important. Decision tables are excellent in that regard. In general, decision tables can be used where these three criteria are met:
- A significant number of rules are parallel -- that is, they share the same subject,
have exactly the same evaluation term(s), and are equivalent (but not identical)
in effect. In other words, the rules all share a common pattern and purpose.
- Each evaluation term has a finite number of relevant instances or ranges of values
- Given the different instances or brackets of the evaluation term(s), the outcomes cannot be predicted by a single formula. (If a single formula could predict the outcomes, using a single rule or set of rules to give the unified formula is a better approach.)
Here is a simple example.
Rule 1: Applicable sales tax is to be 6.0% if year = 1999.
Rule 2: Applicable sales tax is to be 6.5% if year = 2000.
Rule 3: Applicable sales tax is to be 6.5% if year = 2001.
Rule 4: Applicable sales tax is to be 6.5% if year = 2002.
Rule 5: Applicable sales tax is to be 6.25% if year = 2003.
Rule 6: Applicable sales tax is to be 7.0% if year = 2004.
Rule 7: Applicable sales tax is to be 8.0% if year = 2005.
Rule 8: Applicable sales tax is to be 8.15% if year = 2006.
Note that this set of rules satisfies all three criteria above:
- The eight rules are exactly parallel. They share the same subject, applicable
sales tax; have exactly the same evaluation term, year; and are equivalent
(but not identical) in effect, an indicated sales tax percentage for each given year.
- The evaluation term, year, has a finite number of relevant instances (eight).
- The outcomes, the percentages indicated for applicable sales tax, cannot be predicted by a formula. Note that the sales tax rate decreased in 2003 from the previous year -- an apparently infrequent (and perhaps improbable!) tax cut.
The following rule along with Decision Table A shows the consolidated business logic for the eight rules given above. I think you'll agree it's quite an improvement!
|Rule: Applicable sales tax is to be the percent value in Decision Table A for a given year.|
Decision Table A
The decision table above has only a single evaluation term. Most decision tables have more than that. To illustrate, the following rule along with Decision Table B adds a second evaluation term, county, to determine applicable sales tax.
|Rule: Applicable sales tax is to be the percentage in Decision Table B for a given year and county.|
Decision Table B
What about representing more than two evaluation terms using a decision table? That's problematic using a two-dimensional media (for example, paper) unless most of the evaluation terms are simple. (An example of simple would be is order overdue, which can be answered by only yes or no.) If the simple test is satisfied, the business logic can still be represented in variations of the two-dimensional format, for example:
- Splitting rows and/or columns within a single array.
- Multiple arrays, with one array per relevant instance or bracket of one (or more) of the evaluation terms.
Beyond that some different approach is required. At this point (if not before!) an automated support tool becomes just about indispensable. The following rule along with Decision Table C illustrates.
|Rule: The delivery method for an order is to be as in Decision Table C.|
Decision Table C
Delivery Method for an Order
Picked Up by Customer
Shipped by Normal Service
Shipped by Premium Service
Order includes fragile item
Order includes specialty item
Order includes high-priced item
Order includes item involving hazardous materials
Category of customer
Destination of order
Decision Table C establishes the basis for determining the delivery method for an order. Three possible delivery methods (the outcomes) are indicated along the top. Seven decision criteria appear at left as labels for the rows. (This table therefore involves seven dimensions.) Six of these decision criteria are binary (yes, no or local, remote), whereas one, category of customer, involves three possibilities (silver, gold, platinum). The choice of delivery method for an order depends on what appears in the cells of a column. A dash (--) in a cell indicates that the associated decision criteria does not matter in determining the outcome; that is, any alternative for that decision criteria will produce the same outcome.
Such multi-dimension decision tables must be developed with care and then scrutinized closely because they are prone to anomalies and other problems. For example, consider the issue of completeness. How complete is the sample decision table above? Not very! Can you tell why? The answer in next month's column....
# # #
About our Contributor:
All About Concepts, Policies, Rules, Decisions & Requirements
We want to share some insights with you that will positively rock your world. They will absolutely change the way you think and go about your work. We would like to give you high-leverage opportunities to add value to your initiatives, and give you innovative new techniques for developing great business solutions.