Data Flow Diagrams (DFD)
A Data Flow Diagram is a visual tool that shows how data moves through a system — where it comes from, what processes transform it, and where it is stored. DFDs are essential in the analysis and design stages of the SDLC.
Learning Objectives
- 11.2.1.6 Draw and interpret Data Flow Diagrams
Conceptual Anchor
The Plumbing Map Analogy
A DFD is like a plumbing diagram for data. The pipes (arrows) show where data flows. The taps and sinks (external entities) are where data enters and leaves. Valves and filters (processes) transform the data. Tanks (data stores) hold data for later use.
Rules & Theory
DFD Symbols
| Symbol | Shape | Represents | Example |
|---|---|---|---|
| External Entity | Rectangle / Square | Source or destination of data (outside the system) | Customer, Bank, Teacher |
| Process | Rounded rectangle / Circle | An action that transforms data | Validate login, Calculate total |
| Data Store | Open-ended rectangle (two lines) | Where data is stored permanently | D1 Student Database |
| Data Flow | Arrow (→) | Direction data moves | Order details, Payment |
DFD Levels
| Level | Name | Detail |
|---|---|---|
| Level 0 | Context Diagram | Shows the entire system as ONE process, with external entities |
| Level 1 | Main DFD | Breaks the system into major processes, shows data stores |
| Level 2+ | Detailed DFD | Further decomposition of Level 1 processes |
Example: Library System
CONTEXT DIAGRAM (Level 0):
┌──────────┐ ┌──────────┐
│ Student │──── Book Request ───────────→│ │
│ │←─── Book / Rejection ────────│ LIBRARY │
└──────────┘ │ SYSTEM │
│ │
┌──────────┐ │ │
│ Librarian│──── New Book Details ───────→│ │
│ │←─── Reports ────────────────│ │
└──────────┘ └──────────┘
LEVEL 1 DFD:
┌──────────┐ Book Request ┌─────────────┐
│ Student │─────────────────→│ 1. Search │
└──────────┘ │ Catalogue │
↑ └──────┬──────┘
│ │ Book ID
│ ↓
│ ┌─────────────┐ ══════════
│ Book / Rejection │ 2. Process │←──║ D1 Books ║
└─────────────────────────│ Loan │ ══════════
└──────┬──────┘
│ Loan record
↓
══════════════
║ D2 Loans ║
══════════════DFD Rules
| Rule | Description |
|---|---|
| No data flow between entities | External entities don't communicate directly — data must flow through a process |
| No data flow between stores | Data stores don't connect directly — a process must move data between them |
| Label all arrows | Every data flow must have a descriptive label |
| Process must have I/O | Every process must have at least one input and one output |
| Number processes | Use 1, 2, 3... for Level 1; 1.1, 1.2... for Level 2 |
DFD vs Flowchart
A DFD shows what data flows where. A flowchart shows the sequence of steps. DFDs don't show decisions (if/else) or loops — they focus purely on data movement.
Common Pitfalls
Connecting Entities Directly
Two external entities must NEVER have a data flow arrow between them. All data must flow through a process (the system must be involved).
Tasks
Draw and label the 4 DFD symbols.
Draw a Context Diagram for a school exam system (entities: Student, Teacher, Admin).
Draw a Level 1 DFD for an online pizza ordering system.
Self-Check Quiz
Q1: What are the 4 DFD symbols?
Q2: What is a Context Diagram?
Q3: Can two external entities be connected directly?