decision table

{{Short description|Table specifying actions based on conditions}}

class="wikitable"

|+ Play golf dataset

! colspan="4" style="background:red;" | Independent variables

! Dep. var

style="background:yellow;" | Outlook || style="background:yellow;" | Temperature || style="background:yellow;" | Humidity || style="background:yellow;" | Windy || style="background:yellow;" | Play
sunny8585FALSEDon't play
sunny8090TRUEDon't play
overcast8378FALSEPlay
rain7096FALSEPlay
rain6880FALSEPlay
rain6570TRUEDon't play
overcast6465TRUEPlay
sunny7295FALSEDon't play
sunny6970FALSEPlay
rain7580FALSEPlay
sunny7570TRUEPlay
overcast7290TRUEPlay
overcast8175FALSEPlay
rain7180TRUEDon't play

Decision tables are a concise visual representation for specifying which actions to perform depending on given conditions. Decision table is the term used for a Control table or State-transition table in the field of Business process modeling; they are usually formatted as the transpose of the way they are formatted in Software engineering.

Overview

Each decision corresponds to a variable, relation or predicate whose possible values are listed among the condition alternatives. Each action is a procedure or operation to perform, and the entries specify whether (or in what order) the action is to be performed for the set of condition alternatives the entry corresponds to.

To make them more concise, many decision tables include in their condition alternatives a don't care symbol. This can be a hyphen{{cite web |author=LI Jing |date=1 April 2015 |title=SEEM 3430 Tutorial: Decision Tables |url=http://www1.se.cuhk.edu.hk/~seem3430/Tutorial%20Notes/Decision%20Table.pdf |access-date=11 November 2017 |page=23 }}{{cite web |date=6 August 2017 |title=Creating a Decision Table in Business Rules |website=Oracle Help Center |url=https://docs.oracle.com/en/cloud/paas/process-cloud/user/creating-decision-table-business-rules.html#GUID-26D3DF2A-D6D8-404F-834D-EE512E787630 |access-date=11 November 2017}}{{cite journal |last=Ross |first=Ronald G. |year=2005 |title=Decision Tables, Part 2 ~ The Route to Completeness |journal=Business Rules Journal |volume=6 |number=8 |url=https://www.brcommunity.com/articles.php?id=b243 |access-date=11 November 2017}} or blank, although using a blank is discouraged as it may merely indicate that the decision table has not been finished.{{cn|date=November 2017}} One of the uses of decision tables is to reveal conditions under which certain input factors are irrelevant on the actions to be taken, allowing these input tests to be skipped and thereby streamlining decision-making procedures.{{sfn|LI Jing|2015|p=24-25}}

class="wikitable floatright mw-collapsible mw-collapsed"

|+ Demonstration of “don’t care” symbol

{|class="wikitable"

! !! !!colspan="4" |Rules

rowspan="2"|Conditions

|Feeling energetic? || {{yes}} || {{no}} || {{yes}} || {{no}}

Is raining?{{yes}}{{yes}}{{no}}{{no}}
rowspan="3"|Actions

|Stay inside || {{MaybeCheck}} || {{MaybeCheck}} || ||

Go running{{MaybeCheck}}
Tend the garden{{MaybeCheck}}{{MaybeCheck}}

||

class="wikitable"

! !! !!colspan="3" |Rules

rowspan="2"|Conditions

|Feeling energetic? || {{sdash}} || {{yes}} || {{no}}

Is raining?{{yes}}{{no}}{{no}}
rowspan="3"|Actions

|Stay inside || {{MaybeCheck}} || ||

Go running{{MaybeCheck}}
Tend the garden{{MaybeCheck}}{{MaybeCheck}}

|-

|colspan="2" | The two tables convey identical information, but the second one uses a hyphen as a don't-care symbol for brevity.

|}

Aside from the basic four quadrant structure, decision tables vary widely in the way the condition alternatives and action entries are represented.{{cite web |last=Rogers |first=William T. |title=Decision Table Examples: Medical Insurance |website=Saint Xavier University Systems Analysis and Design |url=http://web.sxu.edu/rogers/sys/decision_tables.html |url-status=dead |archive-url=https://web.archive.org/web/20070329015839/http://web.sxu.edu/rogers/sys/decision_tables.html |archive-date=March 29, 2007}}{{cite web |title=Decision tables |url=http://www.cems.uwe.ac.uk/jharney/table.html |url-status=dead |archive-url=https://web.archive.org/web/20120908065107/http://www.cems.uwe.ac.uk:80/jharney/table.html |archive-date=2012-09-08 |access-date=2010-07-07}} Some decision tables use simple true/false values to represent the alternatives to a condition (similar to if-then-else), other tables may use numbered alternatives (similar to switch-case), and some tables even use fuzzy logic or probabilistic representations for condition alternatives.{{cite book |last1=Wets|first1=Geert |last2=Witlox|first2=Frank |last3=Timmermans|first3=Harry |last4=Vanthienen|first4=Jan |chapter=Locational choice modelling using fuzzy decision tables |chapter-url=http://repository.tue.nl/672953 |doi=10.1109/NAFIPS.1996.534708 |title=New frontiers in fuzzy logic and computing: 1996 biennial conference of the North American Fuzzy Information Processing Society – NAFIPS |pages=80–84 |publisher=IEEE |place=Berkeley, CA |year=1996 |isbn=0-7803-3225-3|s2cid=62056954 |url=https://research.tue.nl/nl/publications/cee188c9-baa7-40f5-804a-40e5f857eb13 }} In a similar way, action entries can simply represent whether an action is to be performed (check the actions to perform), or in more advanced decision tables, the sequencing of actions to perform (number the actions to perform).

A decision table is considered balanced or complete if it includes every possible combination of input variables. In other words, balanced decision tables prescribe an action in every situation where the input variables are provided.{{cite web |last=Snow |first=Paul |date=19 July 2012 |title=Decision Tables |website=DTRules: A Java Based Decision Table Rules Engine |url=http://www.dtrules.com/newsite/?p=90 |access-date=11 November 2017}}

Example

The limited-entry decision table is the simplest to describe. The condition alternatives are simple Boolean values, and the action entries are check-marks, representing which of the actions in a given column are to be performed.

The following balanced decision table is an example in which a technical support company writes a decision table to enable technical support employees to efficiently diagnose printer problems based upon symptoms described to them over the phone from their clients.

class="wikitable"

|+Printer troubleshooter

colspan="8" |Rules
rowspan="3"|Conditions

|Printer prints || {{no}}|| {{no}}|| {{no}}|| {{no}}|| {{yes}} || {{yes}} || {{yes}} || {{yes}}

A red light is flashing{{yes}}{{yes}}{{no}}{{no}}{{yes}}{{yes}}{{no}}{{no}}
Printer is recognized by computer{{no}}{{yes}}{{no}}{{yes}}{{no}}{{yes}}{{no}}{{yes}}
rowspan="5"|Actions

|Check the power cable || || || {{MaybeCheck}} || || || || || {{sdash}}

Check the printer-computer cable{{MaybeCheck}}{{MaybeCheck}}{{sdash}}
Ensure printer software is installed{{MaybeCheck}}{{MaybeCheck}}{{MaybeCheck}}{{MaybeCheck}}{{sdash}}
Check/replace ink{{MaybeCheck}}{{MaybeCheck}}{{MaybeCheck}}{{sdash}}
Check for paper jam{{MaybeCheck}}{{MaybeCheck}}{{sdash}}

This is just a simple example, and it does not necessarily correspond to the reality of printer troubleshooting. Even so, it demonstrates how decision tables can scale to several conditions with many possibilities.

Software engineering benefits

Decision tables, especially when coupled with the use of a domain-specific language, allow developers and policy experts to work from the same information, the decision tables themselves.

Tools to render nested if statements from traditional programming languages into decision tables can also be used as a debugging tool.[http://twysf.users.sourceforge.net/example.shtml "A Real CCIDE Example"]{{Cite web |url=http://www.cs.adelaide.edu.au/~dwyer/Cope.html |title=Experience With The Cope Decision Table Processor |access-date=2010-07-07 |archive-url=https://web.archive.org/web/20170504030442/http://cs.adelaide.edu.au/~dwyer/Cope.html |archive-date=2017-05-04 |url-status=dead }}

Decision tables have proven to be easier to understand and review than code, and have been used extensively and successfully to produce specifications for complex systems.Udo W. Pooch, "Translation of Decision Tables," ACM Computing Surveys, Volume 6, Issue 2 (June 1974) Pages: 125–151 {{ISSN|0360-0300}}

History

In the 1960s and 1970s a range of "decision table based" languages such as Filetab were popular for business programming.

Program embedded decision tables

Decision tables can be, and often are, embedded within computer programs and used to "drive" the logic of the program. A simple example might be a lookup table containing a range of possible input values and a function pointer to the section of code to process that input.

class="wikitable"

|+Static decision table

InputFunction Pointer
"1"Function 1 (initialize)
"2"Function 2 (process 2)
"9"Function 9 (terminate)

== Control tables ==

Multiple conditions can be coded for in similar manner to encapsulate the entire program logic in the form of an "executable" decision table or control table. There may be several such tables in practice, operating at different levels and often linked to each other (either by pointers or an index value).

Implementations

  • Filetab, originally from the NCC
  • DETAB/65, 1965, ACM
  • FORTAB from Rand in 1962, designed to be imbedded in FORTRAN[http://www.rand.org/pubs/research_memoranda/RM3306.html "FORTAB: A Decision Table Language for Scientific Computing Applications"], 1962, Rand
  • A Ruby implementation exists using MapReduce to find the correct actions based on specific input values.Alexander Williams (2015). [https://github.com/aw/ruby-decision-table "Ruby decision table parser"]

See also

References

{{reflist}}

Further reading

  • Dwyer, B. and Hutchings, K. (1977) "Flowchart Optimisation in Cope, a Multi-Choice Decision Table" Aust. Comp. J. Vol. 9 No. 3 p. 92 (Sep. 1977).
  • Fisher, D.L. (1966) "Data, Documentation and Decision Tables" Comm ACM Vol. 9 No. 1 (Jan. 1966) p. 26–31.
  • General Electric Company (1962) GE-225 TABSOL reference manual and GF-224 TABSOL application manual CPB-l47B (June 1962).
  • Grindley, C.B.B. (1968) "The Use of Decision Tables within Systematics" Comp. J. Vol. 11 No. 2 p. 128 (Aug. 1968).
  • Jackson, M.A. (1975) Principles of Program Design Academic Press
  • Myers, H.J. (1972) "Compiling Optimised Code from Decision Tables" IBM J. Res. & Development (Sept. 1972) p. 489–503.
  • Pollack, S.L. (1962) "DETAB-X: An improved business-oriented computer language" Rand Corp. Memo RM-3273-PR (August 1962)
  • Schumacher, H. and Sevcik, K.C. (1976) "The Synthetic Approach to Decision Table Conversion" Comm. ACM Vol. 19 No. 6 (June 1976) p. 343–351
  • CSA, (1970): Z243.1–1970 for Decision Tables, Canadian Standards Association
  • Jorgensen, Paul C. (2009) Modeling Software Behavior: A Craftsman's Approach. Auerbach Publications, CRC Press. Chapter 5.