1 of 14

Structuring System Requirements:

Logic Modeling

2 of 14

Logic Modeling

  • Data flow diagrams do not show the logic inside the processes – what occurs within a a process? How input data is converted into output information
  • Logic modeling involves representing internal structure and functionality of processes depicted on a DFD.
  • Processes must be clearly described before translating them into programming language.
  • Logic modeling can also be used to show when processes on a DFD occur.
  • Logic modeling will be generic without taking syntax of a particular programming language

3 of 14

Level-0 Diagram

FIGURE 7-5

Level-0 DFD of Hoosier Burger’s food-ordering system

4 of 14

Logic Modeling Deliverables and Outcomes

Each process on the lowest level DFD will be represented by one or more of the following:

    • Structured English
    • Decision Tables
    • Decision Trees
    • State-transition diagrams
    • Sequence diagrams
    • Activity diagrams

5 of 14

Modeling Logic with Structured English

  • Structured English is a modified form of English used to specify the logic of information processes
  • Uses a subset of English vocabulary to express process procedures
  • No specific standards – each analyst will have his own way
  • File and variable names are CAPITALIZED

Structured English is used to represent processes in a shorthand manner that is relatively easy for users and programmers to read and understand

6 of 14

Modeling Logic with Structured English

  • It is possible to represent all three processes used in structured programming: sequence, conditional, repetition
  • Sequence no special structure but one statement following another
  • ConditionalIF THEN ELSE statement; CASE statement
  • RepetitionDO-UNTIL loops or DO-WHILE loops

Format of Structured English uses indentation used in programming languages

Structured English does not initialize variables, open and close files, or find related records in separate files – all are done in later design process

7 of 14

A sequence of simple, declarative sentences-one after another. Compound sentences are discouraged because they frequently create ambiguity. •

A conditional or decision structure indicates that a process must perform different steps under well-specified conditions. For example,

BEGIN IF

IF Quantity-in-stock is less than Minimum-order-quantity

THEN GENERATE new order

ELSE DO nothing

END IF

• An iteration or repetition structure specifies that a set of steps should be repeated based on some selected condition.

For example,

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

8 of 14

Modeling Logic with� Decision Tables

Structured English is not good to represent complicated logic (having several different conditions) as it becomes difficult to understand

  • Decision table: A matrix representation of the logic of a decision
  • Specifies all the possible conditions and the resulting actions in a tabular form
  • Best used for complicated decision logic

3 Parts of a Decision Table

  1. Condition stubs
    • Lists condition relevant to decision
  2. Action stubs
    • Actions that result from a given set of conditions
  3. Rules
    • Specify which actions are to be followed for a given set of conditions

Indifferent Condition

    • Condition whose value does not affect which action is taken for two or more rules

9 of 14

  • For example, the figure below models the logic of a generic payroll system. The condition stubs contain two conditions employee type (salarized and hourly) and hours worked (less than 40, exactly 40, and more than 40). The action stub contains four courses of action (pay basic salary, calculate hourly wage, calculate overtime, and produce absence report) that result from combining values of the condition stubs. And there 6 rules (each combination of conditions) that result in actions

10 of 14

Decision Table

Note: for salaried employees the action stub chosen will always be the same…therefore hours worked is an indifferent condition

11 of 14

Reduced Decision Table

Because of indifferent condition, the complete decision table can be reduced to one with fewer rules

12 of 14

Modeling Logic with Decision Trees

  • A decision tree is a graphical representation of a decision situation
  • Decision situation points (nodes) are connected together by arcs and terminate in ovals
  • Main components
    • Decision points represented by nodes
    • Actions represented by ovals
    • Particular choices from a decision point represented by arcs
  • To read a decision tree – begin at root node on far left
  • Each node is numbered and each number corresponds to a choice
  • Choices are spelled out in a legend
  • From each node there are at least two paths leading to next step – another decision point or an action
  • All possible actions are listed on the far right in leaf nodes
  • Each rule is represented by tracing a series of paths from root node to the next node and so on until an action oval is reached

13 of 14

Decision tree representation of salary decision

14 of 14

Alternative decision tree representation of salary decision