Topic 5 of 9 · Lab VI
Data Flow Diagrams (DFD): Level 0 and Level 1
What a DFD shows, the four symbols in Gane–Sarson and Yourdon notation, the rules of valid data flows, and how to draw and balance Level 0 (context) and Level 1 diagrams, using the ATM system.
← → move between slides · F full screen · M slide list
Before we start
Why this matters
Before you design screens or classes, you need to know what data comes in, what happens to it, and where it is kept.
A data flow diagram answers exactly that, in a picture a librarian or bank officer can check. Draw it wrong and every later diagram inherits the mistake.
You will learn the four symbols, the handful of rules that make a DFD valid, and how to go from a one-bubble context diagram to a detailed Level 1.
Outline · Lab VI
Topics in this chapter
Select a topic to jump to the slide that explains it.
Concept 1 of 12
What a data flow diagram is
A data flow diagram (DFD) is a picture of how data moves through an information system: where it comes from, which processes change it, where it is stored and where it goes.
- It shows incoming data, outgoing data and stored data.
- It does not show timing, order or decisions — no “if”, no loops.
- Non-technical people can read it, so it is ideal for checking your understanding with users.
| DFD | Flowchart | |
|---|---|---|
| Shows | flow of data | flow of control |
| Decisions (if/else) | no | yes |
| Order of steps | not shown | shown |
| Data stores | yes | no |
| Levels | 0, 1, 2 … | one diagram |
What a DFD is
The four symbols
What a DFD is
The four symbols (cont.)
| Symbol | Meaning | Name it with |
|---|---|---|
| External entity | a source or destination outside the system (person, organisation, other system); drawn at the edges | a noun: Customer, Bank |
| Process | work that transforms data into an output | verb + object: Verify PIN |
| Data store | data kept for later: a table, file or register | a plural noun: Accounts |
| Data flow | data moving between the others; the arrow shows direction | a noun phrase: card no., PIN |
Concept 3 of 12
Levels of DFD
- Level 0 (context diagram): the whole system is one process, surrounded by its external entities. No data stores. It shows the system’s boundary.
- Level 1: the single process is split into its main sub-processes (1.0, 2.0, 3.0 …) and the data stores appear.
- Level 2: one Level-1 process is split further (2.1, 2.2 …). Continue only while it helps understanding.
Concept 4 of 12
The rules of a valid DFD
- Each process has at least one input and one output.
- Each data store has at least one flow in and one flow out.
- Data stored in the system must go through a process.
- An entity cannot send data to another entity without processing.
- Data cannot move directly from an entity to a data store.
- Data cannot move directly from a data store to an entity.
- Data cannot move from one data store to another without a process.
Concept 4 of 12
The rules of a valid DFD (cont.)
Interactive
Check a flow
Concept 6 of 12
Level 0: the ATM context diagram
Concept 6 of 12
Level 0: the ATM context diagram (cont.)
How to draw a Level 0 DFD
- Draw one process in the middle and name it after the system.
- List everyone and everything outside that sends data in or receives data out: these are the external entities.
- For each entity draw the flows in each direction and label them with the data, not the action (“card number, PIN”, not “inserts card”).
- Check: no data stores, no internal detail.
The lab manual’s Level 0 has one entity (the ATM user) with three flows: user info, transaction details and confirmation details.
Level 0 and Level 1 for the ATM
Level 1: the ATM system opened up
Level 0 and Level 1 for the ATM
Level 1: the ATM system opened up (cont.)
- 1.0 checks the card and PIN against the stored PIN in D1.
- 2.0 reads the balance from D1, writes the new balance back and records the transaction in D2.
- 3.0 dispenses cash and prints the receipt using the transaction details.
- Processes are numbered 1.0, 2.0, 3.0; their children will be 2.1, 2.2 …
- Stores are numbered D1, D2 and may appear on several levels.
- Every store has a flow in and a flow out.
Level 0 and Level 1 for the ATM
How to draw a Level 1 DFD
- Start from Level 0: copy the external entities and every flow crossing the boundary.
- List the main things the system does — often one per major feature or use case. Make each a process (verb + object).
- Ask what each process must remember: add data stores.
- Connect the flows; every Level-0 flow must enter or leave one of the new processes.
- Apply the rules: no entity–store or store–store flows, no process without input and output.
- Number processes and stores; check balancing.
Interactive
Zoom through the levels
Concept 10 of 12
Common mistakes
| Mistake | What it looks like | Fix |
|---|---|---|
| Black hole | a process with inputs but no output | add the output, or remove the process |
| Miracle | a process with outputs but no input | find where its data comes from |
| Grey hole | outputs that cannot be produced from the inputs (“receipt” from only “PIN”) | add the missing input flow |
| Control flow | arrows labelled “if valid”, “yes/no”, “next” | label flows with data only |
| Unbalanced levels | Level 1 has a flow that Level 0 does not | add it to Level 0 or remove it |
| Entity talking to a store | Customer → Accounts | put a process in between |
| Process named as a noun | “Database”, “Payment” | verb + object: “Record payment” |
| Too much on one diagram | 15 processes on Level 1 | group them and add a level |
Tools
Drawing DFDs with a tool
- Go to lucidchart.com (or app.diagrams.net, free) and sign in.
- Create a new diagram and enable the Data Flow shape library (Lucidchart: Shapes → + → Data Flow).
- Choose one notation (Gane–Sarson or Yourdon) and use it everywhere.
- Place entities at the edges, processes in the middle, stores between the processes that use them.
- Label every arrow; keep lines straight and avoid crossings.
- Export as PDF or PNG for your LaTeX report.
Your turn
Lab exercise: the Library Management System
Read the scenario and pick out the parts of the DFD before drawing anything:
| Look for… | In the scenario |
|---|---|
| People or systems outside | “user (student or staff)”, “librarian” |
| Things the system does (verbs) | register, issue card, request, reserve, renew, return, pay fine, give feedback, update records |
| Things it must remember (nouns) | members, books, loans/reservations, fines, feedback |
Then decide for yourself:
- Is the librarian an external entity, or part of the system that updates records?
- Which verbs are separate Level-1 processes and which belong together?
- Which store does each process read and write?
- Does your Level 1 balance with your Level 0?
Worked example 1 of 3
Worked example 1
Show the solution
Worked example 2 of 3
Worked example 2
Show the solution
Worked example 3 of 3
Worked example 3
Show the solution
Practice
Practice (1 of 2)
Try each one on paper first, then check your answer.
Show the answer
Show the answer
Show the answer
Practice
Practice (2 of 2)
Try each one on paper first, then check your answer.
Show the answer
Show the answer
Show the answer
Check yourself
Quiz
Resources
Further learning
Hand-picked material to go deeper. Links open in a new tab.
Summary
Summary
- A DFD shows how data enters, is transformed, is stored and leaves a system — not order or decisions.
- Four symbols: external entity, process (verb + object), data store (plural noun), data flow (data name).
- Every flow starts or ends at a process: no entity–entity, entity–store or store–store flows.
- Level 0 is one process with the external entities; Level 1 opens it into sub-processes and stores.
- Levels must balance: a parent’s inputs and outputs equal its child diagram’s.
- Watch for black holes, miracles, grey holes and control flows.