Decision Tables
Lesson Objectives Understand how to model complicated logic using a logic table Determine logical conditions and consequential actions.
An overview Decision tables are a precise yet compact way to model complicated logic. Just like IF-else statements Decision tables link conditions with actions The advantage of decision tables is that we can join many separate conditions with several actions
An Example Take the following bit of code IF X is greater than 6 n Y is less than 7 Then Output “Pass” Else Output “Fail” Conditions X > 6 Y N Y < 7 Actions Output “Pass” X Output “Fail”
Why have them? Decision tables make it easier to observe that all possible conditions are accounted for. Decision tables can be used for: Specifying complex program logic Generating test cases (Also known as logic-based testing)
Have a go Complete a decision table for the following logic If X is greater than 6 and Y is less than 7 or Z is equal to 3 Then Output “Pass” Else Output “Fail”
Have another go! Create a decision table for the following program in an office email system Send email when Recipient address present, subject present, before 5:30pm If after 5:30pm then put in pending folder If Recipient address missing or subject message, give warning message