System Modeling (part 1: 5.1–5.2)
Open in the Padhaiko app5.1 System modeling
System Modeling
System modeling is the process of developing abstract, graphical, and textual representations of a software system from multiple complementary perspectives before writing implementation code.
According to Sommerville, a complete understanding of a software system requires modeling it from four complementary perspectives:
- External Perspective (Context): Models the system boundaries and the external entities (users, hardware, other systems) in its operating environment.
- Interaction Perspective: Models interactions between the system and its environment, or among components inside the system (e.g., use cases, sequence diagrams).
- Structural Perspective: Models the static organization of data or architectural components (e.g., class diagrams, entity-relationship models).
- Behavioral Perspective: Models dynamic system behavior and how the system responds to internal or external events (e.g., activity diagrams, state diagrams, DFDs).
5.1.1 Need for system modeling
Building a complex software system directly from prose requirements invites ambiguity, missed edge cases, and costly architectural rework. System models are essential for five reasons:
- Clarifying Requirements & Reducing Ambiguity: Visual diagrams expose missing inputs, contradictory rules, and unstated assumptions far more quickly than pages of English text.
- Facilitating Stakeholder Communication: Simplified visual models bridge the communication gap between non-technical domain experts and software engineers.
- Analyzing Completeness & Consistency Early: Engineers can trace every input, output, data store, and state transition before committing coding effort—where defects cost less to fix than in production.
- Guiding Architectural & Detailed Design: Models serve as the structural blueprint from which modules, database schemas, and API contracts are derived.
- Providing Living Documentation: Well-maintained models accelerate onboarding for new developers and simplify future system maintenance.
5.1.2 Role of abstractions in managing complexity
Human short-term memory can track only a handful of concepts simultaneously (Miller's rule). Large enterprise or embedded systems contain thousands of interacting functions and states—impossible to reason about all at once.
Abstraction in System Modeling
Abstraction is the selective suppression of irrelevant low-level details so engineers can focus exclusively on the essential concepts and relationships relevant at the current level of analysis.
Abstraction manages complexity through three complementary mechanisms:
- Hierarchical Decomposition (Leveling): A monolithic problem is broken into coarse top-level views (e.g., Level-0 Context Diagram) and progressively refined into detailed lower-level diagrams (Level-1, Level-2), keeping each diagram readable (typically processes per view).
- Selective Perspective Filtering: Rather than forcing structure, data flow, and timing onto a single cluttered chart, each diagram abstracts away other concerns (e.g., a class diagram hides runtime control flow; a DFD hides memory layout and loop counters).
- Encapsulation & Interface Contracts: Treating a complex subsystem as a black-box component with defined inputs and outputs allows higher-level models to reason about system behavior without inspecting internal code.
5.2 Process modeling using DFD
Data Flow Diagram (DFD)
A Data Flow Diagram (DFD) is a graphical process-modeling technique that represents how data flows through a system, the processes that transform the data, the external entities that supply or consume data, and the data stores where information rests.
Unlike flowcharts—which show control flow (loops, if/else branching, execution order)—a DFD shows data flow (data transformations and dependencies) without specifying timing or execution sequence.
| Aspect | Data Flow Diagram (DFD) | Flowchart |
|---|---|---|
| Primary Focus | Flow and transformation of data across processes | Sequence of control (decisions, loops, step order) |
| Execution Model | Processes can operate concurrently whenever input data is ready | Strictly sequential, one execution arrow active at a time |
| Data Persistence | Explicitly represents persistent data stores | Does not model persistent files or database stores separately |
| Phase Used | Requirements analysis & structured system modeling | Detailed algorithm and procedural logic design |
The Four Standard DFD Symbols
| Component | Meaning | Naming Rule | Yourdon / Gane–Sarson Shape |
|---|---|---|---|
| 1. External Entity (Source / Sink) | Person, organization, or external system outside the system boundary supplying or receiving data | Singular noun phrase (e.g., Student, Bank Gateway) | Rectangle / Square (often shaded) |
| 2. Process (Bubble) | Business activity or software function that transforms incoming data flows into outgoing data flows | Verb + Object phrase (e.g., Validate Login, Compute Fine) | Circle (Yourdon) or Rounded Rectangle (Gane–Sarson) |
| 3. Data Flow | Pipeline carrying packets of data in motion from source to destination | Descriptive noun phrase (e.g., Course Request, Fee Receipt) | Directed arrow () |
| 4. Data Store | Repository holding data at rest between processes (files, database tables) | Plural noun phrase (e.g., D1: Student Records) | Open-ended rectangle / Parallel lines |
DFD Leveling (Context, Level 1, and Level 2)
DFDs use hierarchical abstraction so complex systems stay comprehensible:
- Level 0 (Context Diagram): Contains exactly one process (
0: System Name) representing the entire system, surrounded by all external entities and the primary data flows crossing the system boundary. No data stores appear on a Context Diagram (internal storage belongs inside the system boundary). - Level 1 DFD: Decomposes the single context process into major functional sub-processes (
1.0,2.0,3.0, …), exposing internal data stores (D1,D2, …) and inter-process data flows. - Level 2 DFD (and deeper): Further decomposes any complex Level-1 process (e.g.,
2.02.1,2.2,2.3) until each leaf process is simple enough to describe in a short Process Specification (PSPEC).
LEVEL 0 (CONTEXT DIAGRAM):
+----------+ Book Request +-------------------+ Borrow Receipt +-----------+
| Student | ------------------> | 0. Library | -------------------> | Student |
+----------+ | Management Sys | +-----------+
+-------------------+
| Overdue Notice
v
[ Notification ]
LEVEL 1 DFD (DECOMPOSED):
+----------+ Loan Req ( 1.0 Verify ) Valid Req ( 2.0 Issue ) Receipt +---------+
| Student | ----------> ( Member ) -----------> ( Book ) --------> | Student |
+----------+ (____________) (___________) +---------+
| | ^
Read v Update v | Book Status
+---------------+ +---------------+
| D1 | Members | | D2 | Books |
+---------------+ +---------------+Essential Rules for Drawing Valid DFDs
- No Black Holes: Every process must have at least one input data flow and at least one output data flow (a process with inputs only is a black hole).
- No Miracles: A process cannot create output data flows out of nothing (no inputs = miracle).
- No Direct Entity-to-Entity or Store-to-Store Flows: External entities cannot talk directly to each other or directly to a data store without passing through a process.
- Conservation / Balancing Rule: When decomposing a parent process at Level into a Level- child diagram, the net external inputs and outputs entering/leaving the child diagram must match the exact inputs and outputs of parent process .
- Logical vs. Physical DFD: A logical DFD models what the business does (independent of tech:
"Verify Payment"), whereas a physical DFD models how it is implemented ("Stripe_REST_Worker.py","MySQL_Users_Table").
Worked Examples
5.1
Construct a Level-0 Context Diagram and a Level-1 DFD for a University Course Enrollment System where:
- A
Studentsubmits aRegistration Requestand receives anEnrollment ConfirmationorRejection Notice. - An
Administratorpublishes theCourse Catalogand receivesEnrollment Reports. - The system verifies seat availability in
Coursesand updatesEnrollments.
Verify that your Level-1 diagram balances with your Level-0 Context Diagram.
Identify External Entities, Data Stores, and Boundary Flows:
- External Entities:
Student,Administrator. - Incoming Boundary Flows:
Registration Request(fromStudent),Course Catalog(fromAdministrator). - Outgoing Boundary Flows:
Enrollment Confirmation,Rejection Notice(toStudent),Enrollment Reports(toAdministrator). - Internal Data Stores (Level 1 only):
D1: Courses,D2: Enrollments.
Level-0 Context Diagram:
+---------+ Registration Request +------------------------+ Course Catalog +---------------+
| Student | ----------------------> | 0. Course Enrollment | <---------------- | Administrator |
+---------+ | System | ----------------> +---------------+
^ +------------------------+ Enrollment Reports
| Enrollment Confirmation / |
+------------- Rejection Notice ------------+Level-1 DFD and Balancing Check:
+---------------+ Course Catalog ( 1.0 Manage ) Write +---------------+
| Administrator | ----------------> ( Catalog ) -------> | D1 | Courses |
+---------------+ (_______________) +---------------+
^ | Seat Count
| Enrollment Reports v
( 3.0 Generate ) <----- Read Enrollments --- +-------------------+ <--+
( Reports ) | D2 | Enrollments |
(_______________) +-------------------+
^
+---------+ Registration Request ( 2.0 Process ) --+ Write Enrollment
| Student | ----------------------> ( Enrollment )
+---------+ <---------------------- (_______________)
Confirmation / RejectionBalancing Verification:
- Context inflows (
Registration Request,Course Catalog) match Level-1 inflows entering processes2.0and1.0. - Context outflows (
Enrollment Confirmation,Rejection Notice,Enrollment Reports) match Level-1 outflows leaving processes2.0and3.0. - Every process has both inputs and outputs, and no external entity touches a data store directly.
The Level-0 Context Diagram captures boundary interactions with Student and Administrator, and the Level-1 DFD decomposes the system into 1.0 Manage Catalog, 2.0 Process Enrollment, and 3.0 Generate Reports connected via D1: Courses and D2: Enrollments while preserving exact boundary-flow balance.
5.2
During a DFD decomposition audit for an e-commerce order system, a Level-0 Context Diagram has boundary data flows: inflows (Order Details, Payment Confirmation) and outflows (Invoice, Dispatch Instruction). When decomposed into a Level-1 DFD with processes (1.0 Validate Order, 2.0 Process Payment, 3.0 Fulfill Order) and data stores (D1: Inventory, D2: Orders), the analyst counts:
- Process-to-process flows: (
Validated Orderfrom1.0to2.0), (Paid Orderfrom2.0to3.0). - Data-store flows: read/write flows between
1.0andD1, read/write flows between3.0andD2, and write flow from2.0toD2. - Boundary flows on Level 1:
Order Details1.0,Payment Confirmation2.0,2.0Invoice,3.0Dispatch Instruction, plus an extra outflowLow Stock Alertfrom1.0toWarehouse Managerthat was omitted from Level 0.
- Compute the total number of internal flows (process-to-process + data-store flows) and total flows on Level 1.
- Identify the DFD balancing violation and explain how to fix it.
Part 1 — Flow Count Verification:
- Process-to-process flows .
- Data-store flows .
- Total internal flows (equivalently ).
- Total boundary flows present on Level 1 .
- Total data flows on Level 1 .
Part 2 — Diagnose and Fix the Balancing Violation:
To fix the violation, either add external entity Warehouse Manager and outflow Low Stock Alert to the Level-0 Context Diagram (if alerts are truly in scope), or remove Low Stock Alert from Level 1 if it is out of scope.
- Level 1 contains internal flows and boundary flows ( flows total).
- Balancing Violation:
Low Stock AlerttoWarehouse Managerexists on Level 1 without appearing on Level 0; resolve by addingWarehouse ManagerandLow Stock Alertto the Level-0 Context Diagram (or removing it if out of scope).
5.3
How to Answer a Past Exam Question: "Explain the role of abstraction in managing software complexity, and contrast Logical vs. Physical DFDs with a concrete example."
Part 1 — Abstraction and Complexity Management: Define abstraction (suppressing irrelevant details), cite cognitive limits, and explain three concrete mechanisms: hierarchical leveling (Level 0 Level 1 Level 2), multiple orthogonal viewpoints (process vs. data vs. state), and encapsulation/black-box interfaces.
Part 2 — Logical vs. Physical DFD Comparison: Give a side-by-side example for the same operation (e.g., student fee payment):
- Logical DFD: Process
Verify Fee Payment, flowPayment Details, storeStudent Ledger(technology-independent, used in analysis). - Physical DFD: Process
payment_worker.py (Port 8443), flowJSON_PayPayload, storePostgreSQL_fees_tbl(implementation-specific, used in design).
A top-scoring answer pairs hierarchical leveling, perspective separation, and encapsulation under abstraction with a side-by-side Logical vs. Physical DFD illustration showing what happens versus how/where it executes.
Exercises
Practice Exercises — System Modeling & DFD
What is system modeling? Describe the four modeling perspectives used to understand a software system and explain four reasons why system modeling is needed before coding.
System Modeling & Four Perspectives: System modeling builds abstract graphical representations of a system from four perspectives:
- External Perspective: Defines system context and external boundaries.
- Interaction Perspective: Shows communication between users/systems and internal components.
- Structural Perspective: Captures static data and component organization.
- Behavioral Perspective: Depicts dynamic data processing and event responses.
Four Reasons System Modeling Is Needed:
- Exposes ambiguity and missing requirements early.
- Facilitates clear communication with non-technical stakeholders.
- Enables early consistency/completeness verification at low cost.
- Guides architectural/database design and documents the system for future maintainers.
System modeling creates abstract representations across external, interaction, structural, and behavioral perspectives to clarify requirements, align stakeholders, detect design flaws early, and provide lasting system documentation.
Explain how abstraction helps manage software complexity in system modeling, and describe the role of hierarchical leveling in keeping diagrams readable.
Role of Abstraction: Abstraction hides irrelevant implementation details (such as memory addresses, loop counters, or framework boilerplate) so analysts can reason clearly about essential behavior at a given scope without exceeding human cognitive limits.
Hierarchical Leveling: Hierarchical leveling starts with a single high-level overview (e.g., a Context Diagram) and decomposes complex nodes step by step into lower-level diagrams ( nodes per view), allowing engineers to study either the big picture or fine details without clutter.
Abstraction suppresses irrelevant low-level detail so engineers focus on essential structure and behavior. Hierarchical leveling decomposes complex systems into bounded, multi-level views (Level 0, Level 1, Level 2) that keep each diagram clean and understandable.
List the four basic symbols of a Data Flow Diagram (DFD), compare a DFD against a Flowchart, and state four rules that every valid DFD must satisfy.
Four DFD Symbols:
- External Entity: Source or sink outside the system boundary.
- Process: Function transforming input data flows into output data flows.
- Data Flow: Directed pathway of moving data packets.
- Data Store: Persistent repository holding data at rest.
DFD vs. Flowchart & Four Validity Rules: A DFD models data transformations and allows concurrent processes, whereas a Flowchart models sequential control flow (decisions and loops). Four rules: (1) No black holes (process needs output), (2) No miracles (process needs input), (3) No direct entity-to-entity or entity-to-store links without a process, and (4) Parent-child balancing of boundary flows.
DFDs use external entities, processes, data flows, and data stores to model data transformation (unlike flowcharts, which model sequential control). Valid DFDs avoid black holes, miracles, unmediated entity/store links, and parent-child balancing mismatches.
Draw (in structured text/diagram form) a Level-0 Context Diagram and a Level-1 DFD for an ATM Cash Withdrawal System involving a Customer and a Bank Core Server.
Level-0 Context Diagram:
- External entities:
Customer,Bank Core Server. - Process
0. ATM System: receivesCard + PINandWithdrawal AmountfromCustomer, sendsAccount Query / Debit RequesttoBank Core Server, receivesAuth / Balance Response, and outputsCash + Receipt(orError Message) toCustomer.
Level-1 DFD:
1.0 Authenticate User: verifiesCard + PINwithBank Core Server.2.0 Check Balance & Dispense Cash: validates funds againstBank Core ServerandD1: ATM Cash Cassette, updates cassette inventory, and outputsCash.3.0 Print & Log Transaction: writes transaction record toD2: Transaction Logand issuesReceipttoCustomer.
The Level-0 Context Diagram wraps the ATM as one process between Customer and Bank Core Server, and the Level-1 DFD decomposes it into 1.0 Authenticate User, 2.0 Check Balance & Dispense Cash, and 3.0 Print & Log Transaction backed by D1: ATM Cash Cassette and D2: Transaction Log.
Suppose a large Hospital Information System is modeled using hierarchical DFDs where the single Level-0 process decomposes into Level-1 processes, each Level-1 process decomposes into Level-2 processes, and each Level-2 process decomposes into Level-3 leaf processes.
- Compute the number of Level-3 leaf processes and the total number of processes across Levels and .
- Explain why this balanced hierarchical decomposition is far more maintainable than drawing all leaf processes on a single diagram.
Part 1 — Process Count Across Levels:
- Level 0: process.
- Level 1: processes.
- Level 2: processes.
- Level 3 (leaf processes): processes.
Part 2 — Why Hierarchical Abstraction Matters: Drawing leaf processes and their hundreds of data flows on one flat canvas creates an unreadable tangle. Keeping each diagram to processes respects cognitive limits, lets stakeholders inspect high-level workflows on Level 1, and restricts detailed edits to one localized Level-2/Level-3 sub-diagram without breaking global comprehension.
- There are Level-3 leaf processes and total processes across Levels .
- Hierarchical decomposition keeps every diagram to a readable processes, isolating complexity and localizing maintenance changes.