Decision table
Encyclopedia
Decision tables are a precise yet compact way to model complicated logic.

Decision tables, like flowchart
Flowchart
A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. This diagrammatic representation can give a step-by-step solution to a given problem. Process operations are represented in these...

s and if-then-else and switch-case
Switch statement
In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages such as Pascal, Ada, C/C++, C#, Java, and so on. It is also included in several other types of languages...

 statements, associate conditions with actions to perform, but in many cases do so in a more elegant way.

In the 1960s and 1970s a range of "decision table based" languages such as Filetab
Filetab
Filetab is a decision table-based computer programming language.Filetab has a long history, originally designed in the late 1960s and descended from the DETAB programming...

 were popular for business programming.

Structure











The four quadrants
Conditions Condition alternatives
Actions Action entries


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.
Many decision tables include in their condition alternatives the don't care symbol, a hyphen. Using don't cares can simplify decision tables, especially when a given condition has little influence on the actions to be performed.
In some cases, entire conditions thought to be important initially are found to be irrelevant when none of the conditions influence which actions are performed.

Aside from the basic four quadrant structure, decision tables vary widely in the way the condition alternatives and action entries are represented. Some decision tables use simple true/false values to represent the alternatives to a condition (akin to if-then-else), other tables may use numbered alternatives (akin to switch-case), and some tables even use fuzzy logic or probabilistic representations for condition alternatives. 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).

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.

A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients.

The following is a balanced decision table.






























































































Printer troubleshooter
Rules
Conditions Printer does not print Y Y Y Y N N N N
A red light is flashing Y Y N N Y Y N N
Printer is unrecognised Y N Y N Y N Y N
Actions Check the power cable     X          
Check the printer-computer cable X   X          
Ensure printer software is installed X   X   X   X  
Check/replace ink X X     X X    
Check for paper jam   X   X        


Of course, this is just a simple example (and it does not necessarily correspond to the reality of printer troubleshooting), but 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

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.

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
Lookup table
In computer science, a lookup table is a data structure, usually an array or associative array, often used to replace a runtime computation with a simpler array indexing operation. The savings in terms of processing time can be significant, since retrieving a value from memory is often faster than...

 containing a range of possible input values and a function pointer
Function pointer
A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function...

 to the section of code to process that input.




















Static decision table
Input Function Pointer
'1' Function 1 (initialize)
'2' Function 2 (process 2)
'9' Function 9 (terminate)

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
Control table
Control tables are tables that control the program flow or play a major part in program control. There are no rigid rules concerning the structure or content of a control table - its only qualifying attribute is its ability to direct program flow in some way through its 'execution' by an associated...

.

See also

  • Decision tree
    Decision tree
    A decision tree is a decision support tool that uses a tree-like graph or model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility. It is one way to display an algorithm. Decision trees are commonly used in operations research, specifically...

    s
  • Case based reasoning
  • Cause-effect graph
    Cause-effect graph
    In software testing, a cause–effect graph is a directed graph that maps a set of causes to a set of effects. The causes may be thought of as the input to the program, and the effects may be thought of as the output. Usually the graph shows the nodes representing the causes on the left side and...

  • Dominance-based rough set approach
    Dominance-based Rough Set Approach
    Dominance-based rough set approach is an extension of rough set theory for multi-criteria decision analysis , introduced by Greco, Matarazzo and Słowiński...

  • Semantic decision table
    Semantic decision table
    Semantic Decision Tables use modern ontology engineering technologies to enhance traditional decision tables. The name "Semantic Decision Table" was coined by Yan Tang and Prof. Robert Meersman from VUB STARLab in 2006. An SDT is a decision table properly annotated with an ontology...


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
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK