Skip to main content

Purposes of DFD and ER diagram

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

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

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

SymbolMeaning
Circle / rounded boxProcess
ArrowData flow
Open rectangle (two lines)Data store
SquareExternal 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

+----------+  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:

+------------+    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

PointDFDER diagram
ViewFunctional / processData / structural
Main questionWhat happens to data?What data is kept?
Main elementsProcesses, flows, stores, entitiesEntities, attributes, relationships
Time / orderShows flow, not timingNo flow at all
Leads toProgram modulesDatabase tables
Example linkData store D2 OrdersEntity 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.

✓ Answer checked by Claude Sonnet 5.5

All Software Engineering chapter 2 questions →