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
(a.k.a. brackets).
- 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
Year
Applicable
Sales Tax1999
6.0
2000
6.5
2001
6.5
2002
6.5
2003
6.25
2004
7.0
2005
8.0
2006
8.15
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
YEAR
County
Harkin
Lopes
Qwan
Quail
1999
6.95
8.2
7.35
4.0
2000
6.73
8.3
9.0
4.5
2001
6.15
8.4
9.0
5.0
2002
6.15
8.3
9.0
5.5
2003
6.15
8.4
6.75
6.0
2004
6.15
8.2
6.75
6.75
2005
5.75
8.2
6.75
7.0
2006
5.95
8.4
7.5
7.25
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
Decision Criteria
Delivery Method for an Order
Picked Up by Customer
Shipped by Normal Service
Shipped by Premium Service
Rush order No
Yes
Yes
Order includes fragile item No
Yes
--
Order includes specialty item No
No
--
Order includes high-priced item No
No
--
Order includes item involving hazardous materials No
Yes
Yes
Category of customer Silver
Gold
Platinum
Destination of order --
Local
Remote
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:
Online Interactive Training Series
In response to a great many requests, Business Rule Solutions now offers at-a-distance learning options. No travel, no backlogs, no hassles. Same great instructors, but with schedules, content and pricing designed to meet the special needs of busy professionals.
How to Define Business Terms in Plain English: A Primer
How to Use DecisionSpeak™ and Question Charts (Q-Charts™)
Decision Tables - A Primer: How to Use TableSpeak™
Tabulation of Lists in RuleSpeak®: A Primer - Using "The Following" Clause
Business Agility Manifesto
Business Rules Manifesto
Business Motivation Model
Decision Vocabulary
[Download]
[Download]
Semantics of Business Vocabulary and Business Rules