Sei sulla pagina 1di 35

Flow-oriented Modeling

Data Modeling
• Identify the following items
– Data objects (Entities)
– Data attributes
– Relationships
– Cardinality (number of occurrences)

2
Data Flow and Control Flow

• Data Flow Diagram


– Depicts how input is transformed into output as data objects
move through a system
• Process Specification
– Describes data flow processing at the lowest level of
refinement in the data flow diagrams
• Control Flow Diagram
– Illustrates how events affect the behavior of a system through
the use of state diagrams

3
Diagram Layering and Process
Refinement

Context-level diagram

Level 1 diagram

4
Process Specification
Scenario-based Modeling
Writing Use Cases
• Writing of use cases was previously described in
Chapter 7 – Requirements Engineering
• It is effective to use the first person “I” to describe how the actor
interacts with the software
• Format of the text part of a use case

Use-case title:

Actor:

Description: I …

(See examples in Pressman textbook on pp. 188-189) 6


Example Use Case Diagram

Make automated menu


selections Expert Menu
System

Order food and drink

Cook
Notify customer that
food and drink are ready
Customer

Pay for food and drink Payment


System
7
Activity Diagrams

• Creation of activity diagrams was previously described in


Chapter 7 – Requirements Engineering
• Supplements the use case by providing a graphical representation of
the flow of interaction within a specific scenario
• Uses flowchart-like symbols
– Rounded rectangle - represent a specific system function/action
– Arrow - represents the flow of control from one function/action to another
– Diamond - represents a branching decision
– Solid bar – represents the fork and join of parallel activities

8
Example Activity Diagram
Set counter = positive n
Set accumulator = initial value

F
n>1
T
Set accumulator = accumulator * n
Set n = n - 1

F (n mod 5) == 0

T
Display accumulator value

9
Return accumulator value
Class-based Modeling
Example Class Box
Class Name Component

+ componentID
- telephoneNumber
Attributes - componentStatus
- delayTime
- masterPassword
- numberOfTries
+ program()
+ display()
Operations + reset()
+ query()
- modify()
+ call()
11
Example Class Diagram
Accountant Auditor Record
Keeper

Input Production Transaction


Verifier Manager Processor

Report
Error Log Input Handler Account Account List
Generator

1..n

Local File Remote File Accounts Accounts


Handler Handler Receivable Payable

12
Behavioral Modeling
Creating a Behavioral Model

1) Identify events found within the use cases and implied by the
attributes in the class diagrams
2) Build a state diagram for each class, and if useful, for the whole
software system

14
Identifying Events in Use Cases
• An event occurs whenever an actor and the system exchange
information
• An event is NOT the information that is exchanged, but rather the fact
that information has been exchanged
• Some events have an explicit impact on the flow of control, while
others do not
– An example is the reading of a data item from the user versus comparing
the data item to some possible value

15
Building a State Diagram
• A state is represented by a rounded rectangle
• A transition (i.e., event) is represented by a labeled arrow leading from
one state to another
– Syntax: trigger-signature [guard]/activity
• The active state of an object indicates the current overall status of the
object as is goes through transformation or processing
– A state name represents one of the possible active states of an object
• The passive state of an object is the current value of all of an object's
attributes
– A guard in a transition may contain the checking of the passive state of an
object

16
Example State Diagram
pop / set n to 0; return error push [n – 2 < max]

push [n = 0]
Empty Partially pop [n > 1]
Stack Filled Stack
pop [n = 1]

pop [n = max] push [n - 1 = max]

Full Stack

push / set n to max; return error

17
Behavioral Modeling
• One of the fundamental principles for all
requirements analysis methods
• STD represents the behavior of the system
• It depicts the states and the events that
cause the system to change state.
State Transition Diagrams
• A State is any observable mode of behavior
– e.g., reading commands, computing control, waiting for next time
event
• E.g. states for a monitoring and control system for pressure
vessel is monitoring state, alarm state, pressure release state
…….

• States represented as rectangles


• Arrows represent transitions
• Value above arrow identifies event causing transition
• Value below arrow indicates ensuring action
Summary:
Elements of the Analysis Model
Object-oriented Analysis Structured Analysis

Scenario-based Flow-oriented
modeling modeling
Use case text
Data flow diagrams
Use case diagrams
Control-flow diagrams
Activity diagrams
Processing narratives
Swim lane diagrams

Class-based Behavioral
modeling modeling
Class diagrams
State diagrams
Analysis packages
Sequence diagrams
CRC models
Collaboration diagrams
20

Data Flow Diagrams (DFDs) - continued

– Four simple symbols:


(1) External Entity
- source and
destination of
or
data

(2) Process or

(3) Data Store #

or
(4) Data Flow
Process
A data transformer (changes input
to output)

Examples: compute taxes, determine area,


format report, display graph

Data must always be processed in some


way to achieve system function
Data Flow

Data flows through a system, beginning


as input and be transformed into output.

Marks in each course compute


CGPA
CGPA
Data Stores
Data is often stored for later use.

Student ID
CGPA
Compute
CGPA

Marks in each course

CGPA Cr. Hour of each course

student data
• Simple rules:
– left to right, top to bottom, basically (like
English)
– Show all processes
– data flows must start or end in a process
– beware of black holes - every process and data
store must produce data
– no “magic processes” - must enter all needed
data to get data out
Example
In the following example, a DFD will be created based on a paragraph
about Bebop Records Co.’s method of receiving and filling orders.

In this example, the information necessary to create the DFD is


provided for us. In Real Life, this information comes from extensive
interviewing, document gathering, and other research.

Depending upon the system being studied, the number of people


working on it, etc., the development of a detailed DFD can take
anywhere from a few hours to several months (paid for by your client
with NO CODE TO SHOW FOR IT). Yet it is a very standard and
meaningful part of system documentation.
Example
Bebop Records is a mail-order company that distributes
CDs and tapes at discount price to record-club members.
When an order processing clerk receives an order form, he
or she verifies that the sender is a club member by
checking the Member file. If the sender is not a member,
the clerk returns the order along with a membership
application form. If the customer is a member, the clerk
verifies the order item data by checking the Item file. Then
the clerk enters the order data and saves it to the Daily
Orders file. The clerk also prints an invoice and shipping
list for each order, which are forwarded to Order
Fulfillment.
DFD Example - Step 1

FIRST SENTENCE:
Bebop Records is a mail-order company that distributes CDs and tapes at
discount price to record-club members.

RESULT: initial title

Bebop Records
DFD Example - Step 2

SECOND SENTENCE:
When an order processing clerk receives an order form, he or
she verifies that the sender is a club member by checking
the Member file.

RESULT: Bebop Records Order Processing


1.0
Record Club order Verify
Member Member Member Master
Member data
Status

Customer
(non-member)
DFD Example - Step 3
THIRD SENTENCE:
If the sender is not a member, the clerk returns the order along with a
membership application form.

RESULT: Bebop Records Order Processing


2.0
Record Club order Verify
Member Member Member Master
Member data
Status

Customer
(non-member)
Non member order
And application form
DFD Example - Step 4
FOURTH SENTENCE:
If the customer is a member, the clerk verifies the order item data by
checking the Item file.

RESULT: Bebop Records Order Processing

Record Club order Verify


Member Member Member Member Master
Status data

Customer
(non-member)
Verify Item Item Master
Order data
Item data
DFD Example - Step 5

FIFTH SENTENCE:
Then the clerk enters the order data and saves it to the Daily Orders file.

RESULT:
DFD Example - Step 5 continued
RESULT: Bebop Records Order Processing

Record Club order Verify


Member Member Member Member Master
Status data

Customer
(non-member)
Verify Item Item Master
Order data
Item data
Verified
Member
order
Enter order
Into Daily order Daily orders detail
orders
DFD Example - Step 6

SIXTH SENTENCE:
The clerk also prints an invoice and shipping list for each order, which are
forwarded to Order Fulfillment.

RESULT:
DFD Example - Step 6 continued
RESULT: Bebop Records Order Processing
1.0
Record Club order Verify
Member Member Member Master
Member data
Status

2.0
Verify Item Item Master
Customer
Order data
(non-member)
Item data
Verified
Member
3.0order
Enter order order Daily orders detail
Into Daily
orders
Order
4.0 data
Print
Invoice Invoice and Order
And shipping Shipping list fulfillment
list

Potrebbero piacerti anche