Data Flow Diagrams
(DFD)
Data Flow Diagrams
A graphical tool, useful for communicating with
users, managers, and other personnel.
Used to perform structured analysis to determine
logical requirements.
Useful for analyzing existing as well as proposed
systems.
Focus on the movement of data between external
entities and processes, and between processes
and data stores.
A relatively simple technique to learn and use.
Why DFD ?
Provides an overview of-
What data a system processes
What transformations are performed
What data are stored
What results are produced and where they flow
Graphical nature makes it a good communication tool
between-
User and analyst
Analyst and System designer
DFD elements
Source/Sinks (External entity)
Processes
Data Stores
Data flows
Symbols Used:
Gane & DeMarco &
Symbol
Sarson Yourdan Symbol
Symbol
External Entity
Process
Data store
Data flow
5
Descriptions
External Entity - people or organisations that send data
into the system or receive data from the system.
Process - models what happens to the data
i.e. transforms incoming data into outgoing data.
Data Store - represents permanent data that is used by
the system.
Data Flow - models the actual flow of the data between
the other elements.
6
External Entities
They either supply or receive data
• Source – Entity that supplies data to
the system.
• Sink – Entity that receives data from
the system.
They do not process data
Delivery Slip
Processes
Stores demand
note
1.
STORE
Issue Slip
1.0 S
Grade Detail Grade Report
Produce
Grade
Report
Work or actions performed on data (inside the system)
Straight line with incoming arrows are input data flows
Straight lines with outgoing arrows are output data flows
Labels are assigned to Data flow. These aid documentation
Processes
Can have more than one outgoing data flow
or more than one incoming data flow
1.0
Graded Work
Submitted Work Grade
Student Student Grade
Work
3.0
Hours Worked
Gross Pay
Calculated
Pay Rate
Gross
Pay
Processes
Can connect to any other symbol (including another
process symbol)
Contain the business logic, also called business
rules
Referred to as a black box
1.0 2.0 Inventory
Order Accepted Order Change
Verify Assemble
Order
Order
Data Stores Data store
D1 Data Stores D1 Data Stores D1 Data Stores
Writing Readin
Data store g
A Data Store is a repository of data
Data can be written into the data store. This is
depicted by an incoming arrow
Data can be read from a data store. This is depicted
by an outgoing arrow
Data Flows Data Flow
Data in motion
Marks movement of data through the system
- a pipeline to carry data.
Connects the processes, external entities and
data stores.
Data Flow
Generally unidirectional, If same data flows in
both directions, double-headed arrow can be
used.
Can represent flow between process and data
store by two separate arrows
2.1
Payment Detail
D1 Accounts
Invoice Detail Receivable
Post
Payment
Decomposition Of DFD
Levels Description Explanation
Contains only one
Level 0 Context diagram
process
Utilizes all four
Level 1 Overview diagram
elements
A breakdown of a
Level 2 Detailed diagram level 2 process
There is no rule as to how many levels of DFD that can be used.
Rules for Level 0 Diagram :
1 process represents the entire system.
Data arrows show input and output.
Data Stores NOT shown. They are within the
system.
17
Layers of DFD Abstraction for Course Registration System
18
A Context Diagram (Level 0)
The major information flows between the entities
and the system.
A Context Diagram addresses only one process.
19
Rules for Level 1 Diagram :
Level 1 DFD, must balance with the context diagram it
describes.
Input going into a process are different from
outputs leaving the process.
Data stores are first shown at this level.
20
Rules for Level 2 Diagram :
Level 2 DFD must balance with the Level 1 it describes.
Input going into a process are different from
outputs leaving the process.
Continue to show data stores.
21
Numbering
On level 1 processes are numbered 1,2,3…
On level 2 processes are numbered x.1, x.2, x.3… where
x is the number of the parent level 1 process.
Number is used to uniquely identify process not
to
represent any order of processing
Data store numbers usually D1, D2, D3...
22
Rules of Data Flow
Data can flow from Data cannot flow from
External entity to External entity to external
process entity
Process to external entity External entity to store
Process to store and back Store to external entity
Process to process Store to store
Common errors in DFD
24
Three INCORRECT Data Flow
1 .0
Grade Report
Miracle (Spontaneous Produce
generation) Grade
Report
1 .0
Black Hole G r a d e Detail Produce
Grade
Report
Gray Hole 1.0
Student name Grade Report
Produce
Grade
Report
2
Good Style in Drawing DFD
Use meaningful names for data flows, processes and
data stores.
Use top down development starting from context
diagram and successively levelling DFD
Only previously stored data can be read
A process can only transfer input to output. It
cannot create new data
Data stores cannot create new data
Creating DFDs
Create a preliminary Context Diagram.
Identify Use Cases, i.e. the ways in which users most
commonly use the system.
Create DFD fragments for each use case.
Create a Level 0 diagram from fragments.
Decompose to Level 1,2,…
Validate DFDs with users.
Creating the Context Diagram
Draw one process representing
the entire system (process 0)
Find all inputs and outputs that
come from or go to external
entities; draw as data flows.
Draw in external entities as the
source or destination of the
data flows.
Creating Level 0 Diagram
Combine the set of
DFD fragments into
one diagram.
Generally move from
top to bottom, left to
right.
Minimize crossed
lines.
Creating Level 1 Diagram
Each use case is turned into its own DFD.
Take the steps listed on the use case and depict
each as a process on the level 1 DFD.
Inputs and outputs listed on use case become data
flows on DFD.
Include sources and destinations of data flows to
processes and stores within the DFD.
May also include external entities for clarity.
When to stop decomposing
DFDs?
Ideally, a DFD has at
least three levels.
When the system becomes
primitive i.e. lowest level
is reached and further
decomposition is
useless.
Validating DFD
Check for syntax errors to
assure correct DFD
structure.
Check for semantics errors to
assure accuracy of DFD
relative to actual/desired
system.
DFD for University Admission
System
Context Diagram
Student Information Report Request
0
Student University Staff
Admission
System
Admission Approval Report
or Rejection
Level 0
Student Report Request
Information Student
Name & ID Data Item
1 3
Prompt
Admission Approval Perform Generate
Student or Rejection Staff
Intake Reports Data
Procedure Data
Query Items
Prior
Report
Approved Application Data
Application Data
D1 Student Data
Verified
Approved
2 Application
Maintain
Student Other Student Data
Information
Request for Student
Information Maintenance
Level 1 Process 1, Perform Intake Procedure
Student
Information
Admission Application
1.1 1.2
Student Receive Verify
Admission Student Name Admission
Application and ID Application
Verified
Prior Admission
Application D1 Student Data Application
Data
Application
Application Data
Request
Application Approval 1.3
or Rejection Approved Application
Review
Admission
Application
Level 1 Process 2, Maintain
Student Information
Approved Application 2.2
to Add
Add New
Student
Verified Approved
Verified Changed Application
Student Data
2.
3
Approved Application Approved Application to Edit Edit Existing
2.
1 Student
Request for Student Determine ID of Student D1 Student Data
Information Maintenance to Delete
2.
Operation 4
Delete Verified ID of
Existing Student to Delete
Student 2.
5
Determination to Cancel
Cancel Operation Operation
DFD for Lemonade
Stand
Context Diagram
Sales Forecast
Order 0.0
CUSTOMER Lemonade Production Schedule EMPLOYEE
Product Served System Pay
Payment Time Worked
Received Goods
Payment
P
u
r
c
h
VENDOR a
s
e
O
r
d
e
r
Level 0
1.0
Sale
Customer Order Sales Forecast
Product Ordered
Payment
2 Production
CUSTOMER EMPLOYEE
.0
Production
Product Served
Schedule
Received Goods Inventory
3.0
VENDOR Procure- Order
Purchase Order ment Decisions
Payment
Pay Time Worked
4.0
Payroll
Level 1, Process
1
CUSTOMER
Customer Order
ORDER
Request for Forecast
1.1
Record
Order
1.3
Produce
Severed Order Sales
Payment Forecast
Sales Forecast
1.2
Receive PAYMENT
Payment
Level 1, Process 2 and Process 3
Order Decision
Product Order PURCHASE
3.1 ORDER
ORDER Produce
Purchase
2.1 Order Quantity On-Hand
Serve Quantity Severed RAW
Product
Quantity MATERIALS
RAW
Received Received
Production Goods
MATERIAL
S 3.2
Schedule 2.2 Receive
Produce Quantity Used Items
RECEIVED
Product
ITEMS
Payment Approval
INVENTORTY
Production Data
VENDOR
3.3
2.3 Pay
Quantity Produced &
Store Vendor
Location Stored
Product
Payment
Level 1, Process
4
Time Worked
4.1 TIME CARDS
Record
Time
Worked Employee ID
EMPLOYEE
Payroll Request
4.2
Unpaid time cards
Calculate
Payroll
PAYROLL
Payment Approval
4.3
Pay
Employe
e PAYMENTS
Payment
1.1 1.2
1.0
Process Decomposition
Record Receive
Sale
Order Payment
2.1 2.2 2.3
2.0
Serve Produce Store
Production
Product Product Product
0.0
Lemonade
System
3.1
3.0 3.2 3.3
Produce
Procure- Receive Pay
Purchase
ment Items Vendor
Order
4.1 4.3
4.2
4.0 Record Pay
Calculate
Payroll Time Employe
Payroll
Worked e
Context Level Level 0 Level 1
Logical and Physical DFD
DFDs considered so far are called logical DFDs
A physical DFD is similar to a document flow
diagram
It specifies who does the operations specified by
the logical DFD
Physical DFD may depict physical movements of the
goods
Physical DFDs can be drawn during fact gathering
phase of a life cycle
Physical DFD for Cheque Encashment
Cash
Toke
n
Clerk
Cheque Cashier
Verify A/C
CUSTOMER Verify Token
Signature Update Cheque with Take Signature
Balance
Token number
Toke
n
Bad Cheque
Customer Accounts Store cheques Entry in Day Book
Logical DFD for Cheque Encashment
Cheque with
Retrieve Cheque Check Store Token
Token
Customer Balance, no &
Record Issue token cheques
Customer Accounts Token Slip Store cheques
Cheque
or
Cheque
Update
CUSTOMER Search &
Daily cash
match token
book
Token Slip Cheque
with token
Entry in Day
Cash Book
Questions
???