UPI Study › Courses › Software Engineering › Free lessons › Lesson 6.9 Free with a free account
Mapping Data and Control Flow: DFDs and Control Flow Diagrams Compared and Applied
Software Engineering · Chapter 6: Requirements Engineering and PrototypingSection 6.9 · lesson 46 of 1038 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Software Engineering.
Lesson complete
Earn the 3 college credits for Software Engineering
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Documenting Use Cases: Diagrams, Templates, and Best Practices →← Drawing Interactions: UML Use Case Diagrams in ActionNext lesson: Documenting Use Cases: Diagrams, Templates, and Best Practices →
In this lesson
Data flow diagrams and control flow diagrams, compared and applied.
- Define a DFD, and identify its 4 notation elements
- Explain leveling, and why a system is decomposed across levels
- Define a CFD, and distinguish what it models from a DFD
- Explain when to use each - and why teams use both
Transcript
Everything said in the video, section by section (1,057 words). Read along, or search it.
Requirements Engineering and Prototyping
Mapping Data and Control Flow
Some diagrams show where data goes. Others show the order and conditions under which work happens. This section covers one of each. The data flow diagram, and the control flow diagram. It explains what each shows, how data flow diagrams are leveled, and why teams usually use both.
2 Questions, 1 Tangle
Separate the Questions
An analyst tries to capture an order-processing system in a single diagram. It shows where the data comes from and where it goes, along with the exact sequence and conditions under which each step runs. The result is a tangle nobody can read. Data arrows cross sequence arrows, and decision diamonds sit among data stores. Two much clearer diagrams emerge once the two questions are separated. A data flow diagram answers, where does the data move? A control flow diagram answers, in what order, and under what conditions?
Data Flow Diagrams
Where Data Comes From, and Goes
A data flow diagram, or D F D, models how data moves through a system. It shows where data originates, what processes transform it, where it is stored, and where it ultimately goes. And it does that without any timing, sequence, or decision logic. That helps a team and its stakeholders agree on what data exists and how it flows, before deciding how to build the system. D F Ds come from an older tradition called structured analysis, which predates U M L. They remain the right tool for their specific question.
Table 1
4 DFD Notation Elements
A D F D is built from four elements. A process, drawn as a circle, transforms incoming data into outgoing data. For example, validate order. A data flow, drawn as a labeled arrow, carries data between the other elements. For example, the validated order. A data store, drawn as an open-ended rectangle, represents data at rest, like a file or a database table. And an external entity, drawn as a closed rectangle, is a source or sink of data outside the system, like a customer.
Figure 1
A Level 1 DFD for Order Processing
Here is a level one D F D for order processing. The customer sends order details to the first process, validate order. It records the order in the order records store, and passes the validated order on. Process two, process payment, exchanges a payment request and a confirmation with an outside payment processor. It then sends the order total to process three, update inventory, which writes a stock update to the inventory store. Notice that nothing here says when, or in what order, under what conditions. Only where the data goes.
Leveling
Zooming In, Level by Level
A single D F D of an entire system would be overwhelming, so D F Ds are leveled. A level zero diagram, the context diagram, shows the whole system as one process, with only its external entities and boundary flows. It establishes scope. Level one breaks that process into its major sub-processes, connected by more detailed flows and stores. Any process still complex enough can be broken down again, into its own level two diagram, and so on. One rule holds at every level. The data flowing into and out of a process, must match the data in and out of its sub-diagram. No data flow should appear or disappear, just because a diagram zoomed in.
Control Flow Diagrams
When, and Under What Conditions
A control flow diagram, or C F D, models something different. It shows the sequence and logic that control when, and under what conditions, processing steps run. Decisions, branches, loops, and order. Its notation is a small set of shapes. A rounded shape marks where the flow starts and ends. A rectangle is one processing step. A diamond is a decision point, with each outgoing path labeled by its condition. And arrows show the order of steps and decisions, including loops back to an earlier step.
Figure 3
Inside "Process Payment"
In the D F D, process payment is just a bubble. A C F D can zoom in and show how it actually unfolds. First, check the card details. Then a decision. Are they valid? If not, the order is rejected. If they are valid, charge the card. Then another decision. Was the charge approved? If not, the payment is declined. Only when both decisions say yes does the flow reach its end, and confirm the payment.
Table 4
DFD vs. CFD
Here are the two diagrams side by side. A D F D models where data originates, moves, and ends up. A C F D models the order and conditions under which steps run. A D F D ignores timing, sequence, and decisions. A C F D ignores the data being carried. A D F D is most useful for scoping a system, and agreeing on its data. A C F D is most useful for one process's internal decision logic. So they are complementary. A leveled D F D gives the big picture, and a few C F Ds elaborate the processes whose logic is complex.
Apply It
Account Check at Login
Let's apply that. A stakeholder says, first check whether the customer already has an account. If they do, log them in. If not, create one before continuing. That belongs in a C F D. It is entirely about sequence, and a condition. A D F D could only show that account data is checked, and possibly created. It has no notation for the branch itself. And remember, both diagrams describe the system at the level of analysis. Turning that into an actual architecture is a separate, later step.
Key Terms
The Vocabulary of This Section
Let's lock in the key terms. A data flow diagram models how data moves through a system, independent of timing or decision logic. A control flow diagram models the sequence and conditions under which steps execute. A process is a circle that transforms data, and a data store is an open-ended rectangle holding data at rest. An external entity is a closed rectangle, a source or sink of data outside the system's boundary. Leveling organizes D F Ds hierarchically, and the context diagram, at level zero, shows the whole system as a single process.
Key Takeaways
What to Carry Forward
To pull this together. A D F D shows where data moves, using processes, data flows, data stores, and external entities. Leveling zooms from a context diagram down into detail, with the data kept balanced across levels. A C F D shows order and conditions, using start and end shapes, steps, decision diamonds, and arrows. A D F D ignores decision logic, and a C F D ignores the data. Each answers one question. Most projects use both, and both stay at the level of analysis.
About Software Engineering at UPI Study
Software Engineering (Computer Science 301) is a self-paced online course of 103 video lessons in 15 chapters, from process models and agile to requirements, design, user interfaces, reliability, security and project management. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Why take it here
Why students take Software Engineering with UPI Study
Where the credit goes
Universities that work with NCCRS
Software Engineering carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Mapping Data and Control Flow: DFDs and Control Flow Diagrams Compared and Applied
What is a data flow diagram (DFD)?
What are the four symbols used in a data flow diagram?
What does leveling mean in data flow diagrams?
What is the difference between a data flow diagram and a control flow diagram?
About the Software Engineering course
How many college credits is Software Engineering?
How much does Software Engineering cost and what is included?
Which universities accept UPI Study credits?
How long does Software Engineering take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Software Engineering.
103 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
3 credits · NCCRSEnroll →