1. Gyanastra
  2. Software Engineering
  3. Software Design
  4. Structured Design and DFD
Free lesson, no account needed 17 min read 25 practice questions after it
Asked in past papers9 times
  • ISRO20112007
  • UGC NET2014201320112007200620052004

Software Engineering · Software Design

Structured Design and DFD

Overview

Structured design is the classical (Yourdon–Constantine) method that converts the results of structured analysis — mainly the Data Flow Diagram (DFD) — into a hierarchy of modules called a structure chart. The DFD is the analysis model of "what data moves and how it is transformed"; the structure chart is the design model of "which module does what and who calls whom".
UGC NET tests this sub-topic at the level of conventions (symbols, legal and illegal DFD connections, balancing), procedures (transform and transaction analysis, factoring, refinement), and quality metrics (fan-in, fan-out, coupling, cohesion).
Prerequisites: the software life-cycle idea of analysis → design → coding, and the notion of a module.
Everything here is convention-based, so the notes state the convention used (Yourdon–DeMarco for DFD symbols, Page-Jones/Yourdon–Constantine for structure charts) and flag where books differ.

Key concepts

Data Flow Diagram (DFD)

  • A DFD is a graph of four element types: process (transformation of data), data flow (labelled, directed movement of data), data store (data at rest for later use), external entity / terminator (source or sink of data outside the system boundary).
  • Symbols (Yourdon–DeMarco): process = circle/bubble;
    data store = two parallel lines (open-ended rectangle);
    external entity = rectangle;
    data flow = labelled arrow.
    Gane–Sarson draws a process as a rounded rectangle and a data store as an open rectangle; the element meanings never change, only the drawing.
  • Context diagram = level-0 DFD: exactly one process representing the whole system, surrounded by all external entities, showing the net flows crossing the system boundary.
    It fixes the system boundary but contains no data stores and no internal detail.
  • Levelled DFD: level 1 shows the major processes numbered 1, 2, 3 …; level 2 explodes process 1 into 1.1, 1.2, …; and so on. Each process on a parent diagram is exploded in exactly one child diagram.
  • Balancing: the child diagram of process P must have exactly the same net input and output data flows across its boundary as P had on the parent diagram — no more, no less.
    Names may be refined, but the data content must match.
  • Black hole (sink): a process with input flows but no output — data disappears. Miracle (grey hole / spontaneous generation): a process with output flows but no input — data appears from nowhere. Both are errors.
    (A few keys describe a data store with only inbound flows as a "black hole"; the textbook definition applies the term to processes, so answer with the process definition and treat the data-store version as an absorbing store.)
  • Illegal connections in a levelled DFD: data store → data store, external entity → external entity, and (strict convention) external entity → data store directly.
    Data stores and external entities are passive: all movement must pass through a process. Process-to-process, process-to-store, process-to-entity and the reverse are legal.
    A process may legitimately have more inbound than outbound flows (many inputs aggregated into one output).
  • Data dictionary (DD) is the companion repository: it defines every data element, data structure, data flow, data store and process appearing on any level of the DFD; it is the tool used to check consistency and balancing.

Structured design and the structure chart

  • Structured design is a top-down, divide-and-conquer transformation of the DFD into a modular hierarchy; it is done by factoring (producing the first-cut chart) followed by refinement.
  • A structure chart shows modules (rectangles), calls (directed arrows), and couples — the data/control items passed along calls. It is not a flow diagram: the arrows are call arrows, not data-flow arrows.
  • Couple notation: open circle at the arrow tail = data couple; filled circle at the arrow tail = control couple (a flag);
    a small diamond at the lower corner of a module box = a conditional call (the module is invoked only on some paths);
    a curved arrow = iteration/loop;
    double vertical lines at the sides of a box = a library (pre-written, reusable) module.
  • Fan-out of a module = the number of modules it directly calls (its immediate subordinates).
    Fan-in = the number of modules that directly call it (its immediate superordinates).
    A practical limit of about 7 ± 2 is quoted for fan-out.
  • Depth = number of levels in the chart; width = number of modules on a given level.
  • Design goals: high fan-in (reuse — many callers of one module) and low fan-out (each module controls few subordinates), high cohesion, low coupling, and few control couples.
  • Coupling (inter-module dependence), worst → best: content > common > external > control > stamp > data. Content coupling: a module modifies or relies on the internal working of another.
    Common: two modules share the same global data. External: dependence on data/format imposed outside the software (device, file format). Control: one module passes a control flag that steers the other's logic.
    Stamp (data-structure): modules share a composite data structure and each uses only parts of it. Data: modules exchange elementary data items through parameters — the loosest, most desirable.
  • Cohesion (intra-module strength), worst → best: coincidental < logical < temporal < procedural < communicational < sequential < functional. Functional cohesion (one well-defined task) is best.
  • Transform analysis: used when the DFD has a dominant path from input to output; it partitions the DFD into the afferent (input) branch, the central transform, and the efferent (output) branch.
  • Transaction analysis: used when the DFD has a transaction centre — a process that receives a transaction and, on the value of a transaction code, selects exactly one of several mutually exclusive action paths.
  • Structured design is a top-down activity: state the overall structure, postpone low-level decisions, refine level by level (stepwise refinement).

How it works

A. Drawing and levelling a DFD

  1. Identify the external entities (people, devices, other systems) and the net data flows crossing the boundary → draw the context diagram with one process.
  2. Explode the single process into the major sub-processes → level-1 DFD; number them 1, 2, 3 …
  3. Add data stores that hold data between processes; every store must be written by some process and read by some process.
  4. Explode any process that is still complex into a child diagram; number children p.c.
  5. Check balancing for every parent/child pair, and check that no illegal connection (store–store, entity–entity) or black hole/miracle exists.

B. Transform analysis (steps)

  1. Trace the incoming flows to its highest point; that stretch of the DFD is the afferent branch (input portion, "get" the data).
  2. Trace the outgoing flows to their lowest point; that stretch is the efferent branch (output portion, "put" the results).
  3. Whatever lies between the two boundaries is the central transform (the main processing logic).
  4. Factor a first-cut structure chart: a top (boss) module calls an input controller, a transform controller (which calls the central-transform module) and an output controller.
  5. Refine top-down: each DFD process inside a branch becomes a module under its controller; add couples; remove redundant modules; name control modules with "control/get/put" verbs.

C. Transaction analysis (steps)

  1. Locate the transaction centre (the process that receives the transaction and inspects the transaction code) and the action paths leaving it.
  2. Build a top module that calls an input module (to obtain and validate the code) and a transaction dispatcher.
  3. Under the dispatcher place one module per action path; exactly one is executed per transaction — this is a conditional relation, drawn with the diamond convention.
  4. Apply transform analysis separately inside each action branch that is itself complex.

D. Deriving and judging the structure chart

  1. Draw the module hierarchy from the DFD using transform or transaction analysis.
  2. Add data couples (open circles) for every data item that a caller passes down or receives back; add control couples (filled circles) only when a flag is unavoidable.
  3. Compute fan-in and fan-out for each module; restructure to raise fan-in (share common lower-level modules such as validate, format, get-record) and keep fan-out small.
  4. Check cohesion and coupling of every module; a module with two unrelated tasks must be split (that is a cohesion defect), and a module that peeks at another's internals must be fixed with a clean interface (content coupling defect).
  5. Iterate refinement until each module is a single, understandable, reusable unit.
Figure. Notice the single process at the centre, external entities Customer and Kitchen at the boundary, and data flows crossing the boundary: order, bill, prepare request, and prepared items. This is the context diagram before exploding the process into level-1 sub-processes.
Figure. Notice the input branch feeding the central transform, and the central transform feeding the output branch. The text maps these to input, transform, and output controllers in a first-cut structure chart.
Figure. Notice the transaction centre inspecting the transaction code and the three action paths leaving it. Under a dispatcher, one module is placed per action path, and exactly one path is executed per transaction.

Formulas

  • Let M,NM, N denote modules and "M→NM \to N" mean M directly calls N.

  • Fan-out(M)=∣{ N:M→N }∣\text{Fan-out}(M) = \left| \{\,N : M \to N\,\} \right|

  • Fan-in(M)=∣{ N:N→M }∣\text{Fan-in}(M) = \left| \{\,N : N \to M\,\} \right|

  • Total couples (call edges) E=∑MFan-out(M)=∑MFan-in(M)E = \sum_{M} \text{Fan-out}(M) = \sum_{M} \text{Fan-in}(M) — each edge is counted once in each sum.

  • Depth DD = number of module levels; Width WW = maximum number of modules at any one level.

  • Design Structure Quality Index style fractions (Pressman): with S1S_1 = total number of modules and S3S_3 = number of modules whose correct function depends on prior processing, the fraction of modules not dependent on prior processing is x2=1−S3S1.x_2 = 1 - \frac{S_3}{S_1}. Likewise with S2S_2 = modules whose function depends on the source of input data, x1=1−S2/S1x_1 = 1 - S_2/S_1. Both fractions lie in [0,1][0,1] and larger is better.

Worked examples

Example 1 (easy). A DFD shows exactly one process, four external entities and no data stores. What diagram is this, and what must be true of the flows?
Step 1: A single-process, boundary-only DFD is the context diagram (level 0). Step 2: Every flow on it crosses the system boundary, i.e. joins an external entity to the single process.
Step 3: No data store may appear at level 0. Answer: context diagram; it fixes the system boundary and shows only the net data flows between the system and its environment.

Example 2 (medium — balancing). Processes P1, P2, P3 and stores D1, D2 have flows: P1→P2 (f1), P2→P3 (f2), P3→P1 (f3), P2→D1 (f4), D1→P3 (f5), P1→D2 (f6), D2→P2 (f7). A child diagram is to be drawn for P2. Which flows must cross its boundary?
Step 1: Balancing concerns only flows that touch the parent process P2. Step 2: Into P2: f1 (from P1) and f7 (from D2) — two inputs. Step 3: Out of P2: f2 (to P3) and f4 (to D1) — two outputs.
Step 4: f3, f5, f6 never touch P2 and must not appear on the child boundary.
Answer: the child diagram must show exactly f1 and f7 entering and f2 and f4 leaving; internal flows may be refined or split, but the net crossing set must be identical.

Example 3 (hard — numeric fan-in/fan-out). Modules M1…M6: M1 calls M2, M3, M4; M2, M3 and M4 each call M5; M5 calls M6. Find each fan-out, each fan-in, the depth, the width and the number of couples.
Step 1 (fan-out): M1 = 3;
M2 = M3 = M4 = M5 = 1;
M6 = 0.
Step 2 (check): total edges = 3+1+1+1+1 = 7. Step 3 (fan-in): M1 = 0 (root);
M2 = M3 = M4 = 1;
M5 = 3;
M6 = 1;
sum = 7, matching the edge count.
Step 4 (depth): level 0 = M1;
level 1 = M2, M3, M4;
level 2 = M5;
level 3 = M6 → depth = 4. Step 5 (width): the widest level holds 3 modules → width = 3. Answer: fan-out (3,1,1,1,1,0), fan-in (0,1,1,1,3,1), depth 4, width 3, 7 couples;
M5 is the good "high fan-in" module.

Example 4 (statement type). Judge: (i) Common coupling means two modules share global data. (ii) Control coupling means two modules share a composite structure and each uses only part of it.
(iii) Content coupling means one module modifies or depends on the internal working of another. (iv) Data coupling is the most desirable form.
Step 1: (i) matches the definition of common (global) coupling → true.
Step 2: (ii) describes stamp coupling, not control coupling (control = passing a flag that steers logic) → false.
Step 3: (iii) is exactly content coupling → true. Step 4: (iv) data coupling is the loosest and most desirable level → true.
Answer: (i), (iii) and (iv) are correct; (ii) is the common confusion between stamp and control coupling.

Example 5 (match the list). Match A context diagram, B structure chart, C transform analysis, D transaction analysis with: (i) hierarchy of modules with call and couple arrows, (ii) one process plus external entities showing the system boundary, (iii) decomposition around a dispatcher choosing one of several exclusive paths, (iv) decomposition into input, central and output branches.
Step 1: Context diagram = boundary view = (ii). Step 2: Structure chart = module hierarchy = (i). Step 3: Transform analysis = afferent/central/efferent = (iv). Step 4: Transaction analysis = dispatcher with mutually exclusive paths = (iii). Answer: A–ii, B–i, C–iv, D–iii.

Comparison

AspectDFDFlowchartStructure chart
ShowsData movement and transformationControl flow, decisions, sequenceModule hierarchy and calls
Node typesProcess, store, entityAction, decision, start/stopModule
Arrow meaningData flowControl transferCall (superordinate → subordinate)
DecisionsNot shownExplicit (diamond)Only as conditional-call diamond
LevelAnalysis modelLow-level program logicDesign model
FeatureTransform analysisTransaction analysis
Trigger in DFDDominant path input → central processing → outputA centre that selects one of several exclusive paths by a transaction code
Main splitAfferent / central / efferentDispatcher + one module per action path
Top module callsInput controller, transform controller, output controllerInput module + transaction dispatcher
Number of active branchesOne pipelineExactly one per transaction
Coupling (worst → best)DefinitionTypical symptom
ContentOne module alters/relies on another's internalsCode jumps into or edits another module's data/code
CommonShared global dataTwo modules read/write the same global block
ExternalDependence on externally imposed data formatDevice or file-format coupling
ControlA flag passed to steer the receiver's logicBoolean/mode parameter choosing a path
StampShared composite structure, each uses part of itPassing a whole record when two fields are needed
DataOnly elementary data items passedParameters that are plain values — best
Cohesion (worst → best)Meaning
CoincidentalUnrelated statements grouped arbitrarily
LogicalSimilar category of tasks, one selected by a flag
TemporalTasks done at the same time (e.g., initialisation)
ProceduralSteps executed in a fixed order
CommunicationalSame input or output data used
SequentialOutput of one part is input of the next
FunctionalExactly one well-defined task — best
DFD elementPermitted connections
External entityProcess only (never entity, never store, directly)
ProcessProcess, data store, external entity
Data storeProcess only (never another data store)
Data flowMust start and end on an element; must be named

Revision summary

  • DFD has four elements; process is the only active one — stores and entities never talk directly to each other.
  • Balancing = child boundary flows equal parent process flows; nothing added, nothing dropped.
  • Black hole = inputs, no output; miracle = outputs, no input; both are process-level errors.
  • Context diagram = level 0, exactly one process.
  • Transform analysis: Afferent → Central → Efferent; input portion is called the afferent branch.
  • Transaction analysis: a transaction centre picks exactly one of several exclusive paths.
  • Structure chart arrows are calls, not data flows;
    open circle = data couple, filled circle = control couple, diamond = conditional call.
  • Fan-out = how many it calls; fan-in = how many call it; want high fan-in, low fan-out (≈7 ± 2).
  • Coupling worst→best: content, common, external, control, stamp, data; cohesion worst→best ends with functional.
  • Good design = high cohesion + low coupling; structured design is top-down with stepwise refinement.
  • Fraction of modules not dependent on prior processing = 1−S3/S11 - S_3/S_1.
  • DFD ≠ flowchart: DFD has no control sequence and no decisions.

Previous-year exam insights

  • Validity/invalidity of DFD constructs is asked directly: the standard trap is "a data flow between two data stores" (invalid) versus perfectly valid options like a process with more inbound than outbound flows, or a store with several inbound flows.
    Check the element types at both ends of every flow first.
  • Definitions of DFD defects (black hole, miracle, unbalanced child) appear as one-liners; know the difference between a defective process and an unusual-but-legal store.
  • Transform analysis terminology: the input portion is the afferent branch, the output portion the efferent branch, and the middle is the central transform — the distractor options swap these names.
  • Coupling statement questions plant a wrong definition: the classic swap is describing stamp coupling as "control coupling" because modules share a composite structure.
    Also expect "common = shared global data" (true) and "content = touching another module's internals" (true).
  • Cohesion/coupling preference is asked as a combination ("high and low"): high cohesion + low coupling is the only correct pair; "lowest coupling is desirable between modules" is also asked directly.
  • Match List-I with List-II on DFD/structure-chart terms and on coupling types; build the answer from definitions, not from the option order — one wrong pair usually eliminates two options.
  • Numeric fan-in/fan-out questions: draw the call tree, count edges twice (once as fan-out, once as fan-in) to self-check, and remember depth counts levels while width counts modules in the widest level.
  • DFD vs flowchart is a standing question: the correct discriminator is data flow versus control flow, not program size or language.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  1. Name the four DFD elements, draw each in Yourdon–DeMarco notation, and state one legal and one illegal connection for each.
  2. Given a list of DFD flows, mark every construct invalid and justify each rejection in one line.
  3. Explain the context diagram and produce its level-1 explosion with correct process numbering.
  4. Test a parent/child pair for balancing and list exactly which flows must cross the child boundary.
  5. Identify black holes and miracles in a given DFD and say which process must be corrected.
  6. Run transform analysis on a small DFD: mark the afferent branch, the central transform, the efferent branch, and sketch the first-cut structure chart.
  7. Decide whether a DFD is transform-centred or transaction-centred and choose the corresponding design strategy with reasons.
  8. Draw a structure chart for a given call description, label data and control couples, and mark conditional calls and loops.
  9. Compute fan-in, fan-out, depth, width and total couples for a given module graph, and identify the reuse-critical module.
  10. Classify any given pair of modules into one of the six coupling types and any given module into one of the seven cohesion levels, then state the improvement.

Attempt the sub-topic test first, then the subject test.

Pages 1–2 of 2