Objectives
1. Structured English as a tool for representing steps in logical processes 2. Decision tables and decision trees
Learning Objectives
As good as data flow diagrams are for identifying processes, they are not very good at showing the logic inside the processes. There are several methods to represent logic inside processes:
• Structured English • Decision Tables • Decision Trees • State-transition diagrams • Sequence diagrams • Activity diagrams
Introduction
Structured English • Structured English is a modified form of the English language used to specify the logic of information system processes.
Basic logic (programming) structures: • Sequence is represented by listing statements at the same level of
indentation. • Conditional statements are represented by BEGIN IF and END IF statements
and by SELECT CASE statements. • Repetition is represented by DO ... UNTIL and DO…WHILE statements.
• Action verbs represent main functions such as DO, BEGIN, READ, WRITE,
PRINT, SORT, MOVE, MERGE, ADD, SUBTRACT, MULTIPLY and DIVIDE. • Unlike regular English, Structured English does not use adjectives or
adverbs.
Structured English
Examples of Structured English
Example # 1: DO …UNTIL DO READ next Invoice-item-record FIND matching Inventory-record ADD Quantity-added from Invoice-item-record to Quantity-in- stock on Inventory-record UNTIL End-of-file
Example # 2: BEGIN IF …. ENF IF
BEGIN IF IF Employee–Type is Hourly AND Hours–Worked is >40 THEN CALCULATE hourly wage AND CALCULATE overtime
END IF
Examples of Structured EnglishExample # 3: SELECT CASE
SELECT CASE n CASE (describe)…….
(write instructions here) ….. CASE (describe)…….
(write instructions here) ….. CASE (describe)…….
(write instructions here) ….. ENF SELECT
Example:
Select Case n Case Is < -5 PRINT “n is less than -5" Case -4 To -1 PRINT "n is between -4 and -1" Case 0 PRINT "n is 0" Case 2, 4, 6, 8 PRINT "n is even" Case 1, 3, 5, 7, 9 PRINT "n is odd" Case Else PRINT "Only single-digit numbers are allowed" End Select
Current Logical DFD for Hoosier Burger’s Inventory Control System
DO READ next Invoice-item-record
FIND matching Inventory-record
ADD Quantity-added from
Invoice-item-record to Quantity-in-
stock on Inventory-record
UNTIL End-of-file
Decision Tables
• A decision table is a matrix representation of the logic of a decision, which specifies the possible conditions for the decision and the resulting actions. • The steps for creating a decision table are:
(1) name conditions and values each condition can assume; (2) name all possible actions that can occur; (3) list all possible rules; (4) define the actions for each rule; (5) simplify the decision table.
• To reduce the size and complexity of a decision table, use separate, linked decision tables, or use numbers that indicate sequence rather than Xs where rules and action stubs intersect.
Decision Tables
Decision Tables
Provided below is a sample decision table for the relatively simple process, Generate Payments.
Conditions/ Rules Courses of Action 1 2 3 4 Employee Type Salary Hourly Hourly Hourly Hours Worked - <40 40 >40 Pay Base Salary X Calculate hourly wage X X X Calculate overtime X Produce absence report X
Decision Trees
• A decision tree is a graphical representation of a decision situation in
which decision points (nodes) are connected together by arcs (one for each alternative on a decision) and terminate in ovals (the action which is the result of all of the decisions made on the path that leads to that oval). • Decision trees are organized in a hierarchical fashion, starting with the root node on the far left, and proceeding to subsequent decision nodes. All possible actions are listed in leaf nodes on the far right.
Deciding Among Structured English, Decision Tables, and Decision Trees
BestBestThird BestChecking Consistency and Completeness
BestThird BestBestTransforming Conditions and Actions into Sequence
BestThird BestSecond BestDetermining Conditions and Actions
Decision TreesDecision TablesStructured English
Criteria
Deciding Between Decision Tables and Decision Trees
WorstBestEasier to manipulate
WorstBestMore compact
BestWorstMaking decisions
BestWorstPortraying simple rules
WorstBestPortraying complex logic
Decision TreesDecision TablesCriteria
Top Related