Wednesday, August 11, 2010

“Decision Tables”

Decision tables are a precise yet compact way to model complicated logic
Decision tables, like flowcharts and if-then-else and switch-case statements, associate conditions with actions to perform, but in many cases do so in a more elegant way.
The decision table is typically divided into four quadrants, as shown below.
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.
 A decision table lists causes and effects in a matrix. Each column represents a unique combination.
 Purpose is to structure logic


Cause = condition
Effect = action = expected results

Steps to Create a decision table

1. List all causes in the decision table
2. Calculate the number of possible combinations
3. Fill columns with all possible combinations
4. Reduce test combinations
5. Check covered combinations
6. Add effects to the table
Step 1: List all causes

Hints:
 Write down the values the cause/condition can assume
 Cluster related causes
 Put the most dominating cause first
 Put multi valued causes last


Step 2: Calculate combinations

If all causes are simply Y/N values:
2number of causes`
 If 1 cause with 3 values and 3 with 2:
31 * 23 = 24
 Or, use the Values column and multiply each value down the column, eg. 3*2*2*2=24
Step 3: Fill columns

 Algorithm:
1. Determine Repeating Factor (RF): divide remaining combinations by the number of possible values for that cause
2. Write RF times the first value, then RF times the next etc. until row is full
3. Next row, go to 1.


Step 4: Reduce combinations
 Find indifferent combinations – place a ‘-’
 Join columns where columns are identical
 Tip: ensure the effects are the same

Step 5: Check covered combinations

 Checksum
 For each column calculate the combinations it represents
 A ‘-’ represents as many combinations as the cause has
 Multiply for each ‘-’ down the column
 Add up total and compare with step 2



Step 6: Add effects to table

 Read column by column and determine the effects
 One effect can occur in multiple test combinations

No comments:

Post a Comment