Title: Logic Modeling ch5 pp.173180
1Logic Modeling(ch5 pp.173-180)
2Logic Modeling
- Representing the details of the processes that
have been identified during process modeling. - During Analysis, logic modeling is detailed but
generic. - Used as a communication tool between users,
analysts, and programmers
3Logic Modeling Approaches
- Structured English to represent process logic
- Decision Tables
4Structured English a technique for representing
the "processing" contents of a DFD process
- modified form of English used to represent
process details - Strong verbs to describe process action
- read, write, print, sort, move, merge, add,
subtract, multiply, divide - Basically, pseudo code to describe each process
bubble at the functional primitive level - There is no right way to write pseudo code. Just
have a method and be consistent throughout
document
5Structured English
- Example...
- Show processing logic for a bank's service charge
calculation - Process Calculate Customer Service Charge
6Example of one form of the process
- READ summary of customer monthly balances
- BEGIN IF
- IF daily-balance is lt 300 for any given day
- THEN set service-charge to 5
- ELSE set service-charge to 0
- END IF
7More complex example that includes account type
- READ customer account-type and summary of
customer monthly balances - SELECT CASE
- CASE 1 (account-type is NOW)
- BEGIN IF
- IF daily-balance lt 300 for any given day
- THEN set service-charge to 5
- ELSE set service-charge to 0
- END IF
- CASE 2 (account-type is REGULAR)
- BEGIN IF
- IF daily-balance lt 100 for any given day
- THEN set service-charge to greater of 3 or
.20 times number-checks - ELSE set service-charge to 0
- END IF
- END CASE
8Three Parts to Structured Programs
- Sequence
- Conditions
- Repetition
- Sequence we show by just listing things top to
bottom in descending order - Conditions and Repetition we show just like in a
Visual Basic subprocedure
9CONDITIONAL STATEMENTS
- Conditions IF/THEN/END IF SELECT CASE / END
CASE (or END SELECT if you like) - BEGIN IF
- IF Quantity-in-stock is less than
Minimum-order-quantity - THEN GENERATE new order
- ELSE DO nothing
- END IF
10CONDITIONAL STATEMENTS
- READ Quantity-in-stock
- SELECT CASE
- CASE 1 (Quantity-in-stock greater than
Minimum-order-quantity) - DO nothing
- CASE 2 (Quantity-in-stock equals
Minimum-order-quantity) - DO nothing
- CASE 3 (Quantity-in-stock is less than
Minimum-order quantity) - GENERATE new order
- CASE 4 (Stock out)
- INITIATE emergency re-order routine
- END CASE
11REPETITION
- DO
- READ Inventory records
- BEGIN IF
- IF Quantity-in-stock is less than
Minimum-order-quantity - THEN GENERATE new order
- ELSE DO nothing
- END IF
- UNTIL End-of-file
12REPETITION
- READ Inventory records
- WHILE NOT End-of-File DO
- BEGIN IF
- IF Quantity-in-stock is less than
Minimum-order-quantity - THEN GENERATE new order
- ELSE DO nothing
- END IF
- END DO
13Misc. Info on Structured English
- Indent just like in programming to signify groups
of processes - Suggestions
- All caps for programming keywords
- cap first letter in nouns
- hyphenate phrases
- Write out conditions (less than instead of lt
) - Dont do tech details like initialize variables,
etc. - Note Figure 5-14 and 5-15 in the book are only
appropriate if level 0 is also the functional
primitive level
14DECISION TABLES
- a matrix representation of the logic of a
decision - CONDITION STUBS
- The part of a decision table that lists the
conditions relevant to the decision. - ACTION STUBS
- The part of a decision table that lists the
actions that result for a given set of
conditions. - RULES
- The part of a decision table that specifies which
action items are to be followed for a given set
of conditions.
15Condition Stubs
Action Stubs
16CONSTRUCTING DECISION TABLES
- 1. Name the conditions and the 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 by removing any
rules with impossible actions or with
indifferent conditions
17INDIFFERENT CONDITION
- In a decision table, a condition whose value does
not affect which actions are taken for two or
more rules. - Example follows this slide for reducing table by
taking out extra columns for salaried employees
18(No Transcript)
19(No Transcript)
20The next 2 slides are from the book. Lets work
through reducing figure 5-18 into figure 5-19
21Complete decision table for inventory reorder
system (fig. 5-18)
22Reduced decision table for inventory reorder
system (fig. 5-19)
23When to use Structured English and when Decision
Tables?
- Use the one that is more clear or use both in
combination - The point is to communicate to the developers and
the client