Home
5Data Flow Diagrams (DFD): Level 0 and Level 1
5

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.

  1. What a DFD is
  2. Levels and balancing
  3. DFD rules
  4. Level 0 and Level 1 for the ATM
  5. Level 2 and beyond
  6. Common mistakes

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.
DFDFlowchart
Showsflow of dataflow of control
Decisions (if/else)noyes
Order of stepsnot shownshown
Data storesyesno
Levels0, 1, 2 …one diagram

What a DFD is

The four symbols

The same four ideas in the two common notations. This course uses Yourdon circles.

What a DFD is

The four symbols (cont.)

SymbolMeaningName it with
External entitya source or destination outside the system (person, organisation, other system); drawn at the edgesa noun: Customer, Bank
Processwork that transforms data into an outputverb + object: Verify PIN
Data storedata kept for later: a table, file or registera plural noun: Accounts
Data flowdata moving between the others; the arrow shows directiona 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.
Balancing: the flows entering and leaving a process must be exactly the flows entering and leaving its child diagram. If Level 0 shows “card number, PIN” going in, Level 1 must show the same flow entering one of its processes.
Keep each diagram to roughly 3–9 processes. More than that means you should add a level.

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.)

One rule covers them all: every flow starts or ends at a process.

Interactive

Check a flow

Concept 6 of 12

Level 0: the ATM context diagram

The whole ATM system is one process, numbered 0.

Concept 6 of 12

Level 0: the ATM context diagram (cont.)

How to draw a Level 0 DFD

  1. Draw one process in the middle and name it after the system.
  2. List everyone and everything outside that sends data in or receives data out: these are the external entities.
  3. For each entity draw the flows in each direction and label them with the data, not the action (“card number, PIN”, not “inserts card”).
  4. 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 1: three processes and two data stores. The Customer’s flows match Level 0 exactly.

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

  1. Start from Level 0: copy the external entities and every flow crossing the boundary.
  2. List the main things the system does — often one per major feature or use case. Make each a process (verb + object).
  3. Ask what each process must remember: add data stores.
  4. Connect the flows; every Level-0 flow must enter or leave one of the new processes.
  5. Apply the rules: no entity–store or store–store flows, no process without input and output.
  6. Number processes and stores; check balancing.
A note on the lab manual. Its Level 1 (Figure VI.3) draws the parent process “1 ATM Machine System” inside its own Level 1 diagram. In a balanced DFD the parent is replaced by its children, so it should not appear. Its Level 2 (Figure VI.4), with the customer and transaction databases, is closer to what a Level 1 should look like — the version on the previous slide.

Interactive

Zoom through the levels

Concept 10 of 12

Common mistakes

MistakeWhat it looks likeFix
Black holea process with inputs but no outputadd the output, or remove the process
Miraclea process with outputs but no inputfind where its data comes from
Grey holeoutputs that cannot be produced from the inputs (“receipt” from only “PIN”)add the missing input flow
Control flowarrows labelled “if valid”, “yes/no”, “next”label flows with data only
Unbalanced levelsLevel 1 has a flow that Level 0 does notadd it to Level 0 or remove it
Entity talking to a storeCustomer → Accountsput a process in between
Process named as a noun“Database”, “Payment”verb + object: “Record payment”
Too much on one diagram15 processes on Level 1group them and add a level

Tools

Drawing DFDs with a tool

  1. Go to lucidchart.com (or app.diagrams.net, free) and sign in.
  2. Create a new diagram and enable the Data Flow shape library (Lucidchart: Shapes → + → Data Flow).
  3. Choose one notation (Gane–Sarson or Yourdon) and use it everywhere.
  4. Place entities at the edges, processes in the middle, stores between the processes that use them.
  5. Label every arrow; keep lines straight and avoid crossings.
  6. Export as PDF or PNG for your LaTeX report.
Draw Level 0 first and get it approved by your team before starting Level 1 — most mistakes are about the system boundary.

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?
This is your lab report: the diagrams must be your team’s own work.

Worked example 1 of 3

Worked example 1

Is this flow legal? “Customer → D1 Accounts: new address”. If not, fix it.
Show the solution
Illegal: an entity cannot write straight into a store. Add a process: Customer → 4.0 Update profile (new address) → D1 Accounts (updated address).

Worked example 2 of 3

Worked example 2

Level 0 shows Customer → System: “card number, PIN” and “request, amount”, and System → Customer: “cash, receipt”. Level 1 adds 2.0 → Customer: “balance display”. Is it balanced?
Show the solution
No. Level 1 has an output (“balance display”) that Level 0 does not. Either add “balance” to the Level-0 flow to the Customer (e.g. “cash, receipt, balance”) or remove it from Level 1.

Worked example 3 of 3

Worked example 3

Process 3.0 “Print receipt” has only one input: “PIN”. What kind of error is this?
Show the solution
A grey hole: the output (a receipt with amount, date and balance) cannot be produced from the input. Add the flow “transaction details” from D2 Transactions (or from process 2.0).

Practice

Practice (1 of 2)

Try each one on paper first, then check your answer.

1. Name the four DFD components and their Yourdon symbols.
Show the answer
External entity (rectangle), process (circle), data store (two parallel lines / open rectangle), data flow (labelled arrow).
2. Why does a Level 0 DFD never show data stores?
Show the answer
Level 0 shows the whole system as one process; stores are inside the system, so they only appear when the process is opened up at Level 1.
3. Give two differences between a DFD and a flowchart.
Show the answer
A DFD shows data movement and storage without order or decisions; a flowchart shows the sequence of control with decisions and loops but no data stores.

Practice

Practice (2 of 2)

Try each one on paper first, then check your answer.

4. Lab task hint: name three data stores you would expect in a Library Management System.
Show the answer
For example: D1 Members, D2 Books, D3 Loans (issues, returns, reservations). Fines and feedback may be separate stores or part of others — justify your choice.
5. What is a “black hole” in a DFD?
Show the answer
A process that receives data but produces no output.
6. How are the child processes of 2.0 numbered at Level 2?
Show the answer
2.1, 2.2, 2.3 …

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.