---
title: "Purposes of DFD and ER diagram"
subject: "Software Engineering"
chapter: 2
key: "semester_5/software_engineering:dfd-er-purpose"
source: https://www.bctengineer.com/q/semester_5/software_engineering/dfd-er-purpose
site: BCT Engineering
---

# Purposes of DFD and ER diagram

Software Engineering · Chapter 2: System model

- Asked in: 2070 Chaitra (old course), 10 marks
- Video: [What is DFD? How to design DFD, Symbols, examples full explanation](https://www.youtube.com/watch?v=KN-inGJG540) — Gate Smashers
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/software_engineering/dfd-er-purpose
- Whole chapter: https://www.bctengineer.com/md/semester_5/software_engineering/chapter-2

## Question

What are the main purposes of DFD and ER diagram? Explain with example.

## Short answer

DFD models system processing: shows functions, data flows, system boundary, supports top-down analysis, communicates with users, finds errors early, and provides design basis. ER diagram models data: logical structure, entities/attributes/keys, relationships/cardinality, basis for database design, communicates data requirements, and ensures consistency with DFD. Example: online order system with DFD processes (validate order, process payment, dispatch) and ER entities (Customer, Order, Product).

## Answer

A **Data Flow Diagram (DFD)** models the *processing* side of a system: how data enters, is transformed by processes, is stored, and leaves. An **Entity-Relationship (ER) diagram** models the *data* side: which things (entities) the system keeps data about, their attributes, and how they are related. Together they give the functional view and the data view of the same system.

#### Purposes of DFD
1. **Show the functions of the system** – every process (bubble) shows one transformation of input data into output data.
2. **Show the flow of data** between external entities, processes and data stores, so the analyst sees where each data item comes from and where it goes.
3. **Define the system boundary** – the context diagram (level 0) shows what is inside the system and which external entities it talks to.
4. **Support top-down analysis** – the system is refined level by level (level 0 → level 1 → level 2), which controls complexity.
5. **Communicate with users** – DFDs use only four symbols, so non-technical users can check them.
6. **Find errors early** – missing inputs, unused outputs and duplicated processing become visible.
7. **Basis for design** – processes in the DFD map to modules in the structure chart.

DFD symbols (Yourdon/DeMarco):

| Symbol | Meaning |
|---|---|
| Circle / rounded box | Process |
| Arrow | Data flow |
| Open rectangle (two lines) | Data store |
| Square | External entity (source/sink) |

#### Purposes of ER diagram
1. **Model the logical structure of data** independent of how it is processed or stored.
2. **Identify entities, attributes and keys** (e.g. Customer with `cust_id` as primary key).
3. **Show relationships and cardinality** (1:1, 1:N, M:N) and participation constraints.
4. **Basis for database design** – entities become tables, relationships become foreign keys or link tables.
5. **Communicate data requirements** to users and database designers using one common picture.
6. **Check consistency** – each data store in the DFD should be backed by entities in the ER diagram.

ER symbols: rectangle = entity, ellipse = attribute, diamond = relationship, lines with 1/N/M = cardinality.

#### Example: online order processing system
Assume a shop where a customer places an order, payment is processed and goods are dispatched.

**Level-1 DFD**

```text
+----------+  order details  +---------------+
| Customer |---------------->| 1.0 Validate  |
+----------+                 |     order     |
     ^                       +---------------+
     |                         ^        | valid order
     |       customer details  |        v
     |   ==================    |  +---------------+
     |    D1 Customers  -------+  | 2.0 Process   |
     |   ==================       |     payment   |
     |                            +---------------+
     |                                  | paid order
     |  invoice + goods                 v
     |                            +---------------+
     +----------------------------| 3.0 Dispatch  |
                                  |     goods     |
                                  +---------------+
                                        | order record
                                        v
                                 ==================
                                  D2 Orders
                                 ==================
```

**ER diagram** for the data used above:

```text
+------------+    1    /\    N    +-----------+
|  CUSTOMER  |------<places>------|   ORDER   |
+------------+         \/         +-----------+
 cust_id (PK)                      order_id (PK)
 name, address                     date, amount
                                        | M
                                       /\
                                   <contains>
                                       \/
                                        | N
                                  +-----------+
                                  |  PRODUCT  |
                                  +-----------+
                                   prod_id (PK)
                                   name, price
```

- One customer places many orders (1:N).
- One order contains many products and a product appears in many orders (M:N), so the database needs an `Order_Item(order_id, prod_id, qty)` table.

#### How the two diagrams work together

| Point | DFD | ER diagram |
|---|---|---|
| View | Functional / process | Data / structural |
| Main question | What happens to data? | What data is kept? |
| Main elements | Processes, flows, stores, entities | Entities, attributes, relationships |
| Time / order | Shows flow, not timing | No flow at all |
| Leads to | Program modules | Database tables |
| Example link | Data store *D2 Orders* | Entity *ORDER* |

The DFD tells us *what the system does*; the ER diagram tells us *what the system must remember*. A complete structured analysis uses both.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What main question does a DFD answer compared with an ER diagram?
   A. DFD: what data is kept; ER: what happens to data
   B. DFD: what happens to data; ER: what data is kept
   C. Both show the order of events over time
   D. DFD shows tables; ER shows modules
   Answer: B. A DFD models processing (functional view); an ER diagram models the stored data (data view). (Key point: DFD vs ER view)

2. What does the context diagram (level 0) of a DFD show?
   A. Every database table
   B. Only the data dictionary
   C. The system boundary and the external entities it interacts with
   D. The code of each module
   Answer: C. Level 0 shows the whole system as one process and the external entities it communicates with, defining its boundary. (Key point: Context diagram)

3. In the Yourdon/DeMarco DFD notation, which symbol is an external entity?
   A. Circle or rounded box
   B. Arrow
   C. Open rectangle with two lines
   D. Square
   Answer: D. A square is a source or sink (external entity); a circle is a process, an arrow a data flow, and an open rectangle a data store. (Key point: DFD symbols)

4. In the order example, an order contains many products and a product appears in many orders. How is this M:N relationship implemented in the database?
   A. By an extra link table such as Order_Item(order_id, prod_id, qty)
   B. By storing all products in one cell of ORDER
   C. By merging CUSTOMER and PRODUCT
   D. M:N relationships cannot be stored
   Answer: A. An M:N relationship needs a link table holding the keys of both entities, here Order_Item. (Key point: M:N relationships)

5. What does each diagram lead to in design?
   A. DFD to database tables; ER to program modules
   B. Both lead only to user manuals
   C. DFD to program modules; ER to database tables
   D. Neither is used in design
   Answer: C. DFD processes map to modules in the structure chart; ER entities become tables. (Key point: Leads to)

## Related in other subjects

- [ER diagram: cricket tournament](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Aer-cricket-tournament) — Database Management System, chapter 2
- [ER diagram: employee, skill, machine](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Aer-employee-skill-machine) — Database Management System, chapter 2
- [ER diagram: product and components](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Aer-product-component) — Database Management System, chapter 2
- [ER diagram: hospital management](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Aer-hospital) — Database Management System, chapter 2
