You are on page 1of 9

Parts of a Decision Table

1 2 3 4

CONDITION A Y Y N N
CONDITION B Y N Y N
CONDITION

ACTION A X X X -
ACTION B - X X X
ACTION C X - X -
ACTION

STUB RULES

 4 main parts
 Condition stub
 Condition entries
 Action Stub
 Action entries
Benefits of
Using Decision Table

 Clear cut procedure for identifying


conditions and actions
 Establish relationships between
conditions and actions
 Possible to examine all
alternatives
 Forces programmer to think
logically
 Easy to construct and to
understand
 Excellent documentation for
communication
 Readily translated into program
code
Characteristics of Limited
Entry
Decision Table

 Self checking
 Decision expressed in questions
answered by “YES” or “NO”
 R=2C
where R is no. of rules
C is no. of conditions
Steps to Decision Table

1. List conditions vertically.


2. List rules horizontally.
3. Half rules with “Y” & the rest
with “N”
4. Half “Y” with “Y” & the rest
with “n”
5. Repeat step (3) & (4)
6. List actions in sequence
7. Mark “X” for actions
8. Mark “-” for no actions
Hierarchy of Decision Table
 Example: A ‘high level’ decision
table
CONDITION 1 Y N N
CONDITION 2 - Y N

USE DECISION X X -
TABLE 2 - X X
USE DECISION
TABLE 3

 Example: A ‘high level’ decision


table
CONDITION 3 Y N N N
CONDITION 4 - Y N N
CONDITION 5 - - Y N

ACTION 1 X X - -
ACTION 2 - X X -
ACTION 3 - - - X
Hierarchy of Decision Table

 Example: The 2nd ‘subordinate’


table

CONDITION 6 Y N N
CONDITION 7 - Y N

ACTION 1 X X -
ACTION 2 - X X
Extended Entry Decision
Table

 Rule entry extended from “Yes” or


“No” to value entry
 Example:
 Limited entries

A > B? Y N N
A = B? - Y N

 Example:
 Extended condition entries

A:B > = <

 No of rules = C1 x C2 x C3… where


C1 is no. of entries for condition 1
Decision Table
Preprocessors

 Software
 Transform decision table into
suitable input form
 Produces source code
 Example: COBOL
 Limit possibility of errors
 Check the validity of logic
expressed in decision table form
 Directly produce object code
used for testing
Condition 1 2 3 4 5 6 7 8

CUST-TYPE =‘T’ Y Y Y Y N N N N
QUANTITY > 500 Y Y N N - - - -
QUANTITY > 200 - - - - Y Y N N
DISTANCE > 0 Y N Y N Y N Y N

Action

UNIT-PRICE=5 X X X X - - - -
UNIT-PRICE=6 - - - - X X X X
DISCOUNT=10% X X - - - - - -
DISCOUNT=5% - - - - X X - -
DELIVERY- X - X - - - - -
CHARGE=200 - - - - X - X -
DELIVERY- X X X X X X X X
CHARGE=100
CALCULATE
CHARGE

You might also like