NivaarExam PrepOfficial exam papers ↗

25-Comp-A6 Software Engineering · December 2016

Question 2 of 8: Software Design

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — December 2016 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: eight questions, candidates answer any five of the eight (all questions equal weight — each of the five counted questions is worth 20%; only the first five questions as they appear in the answer book are marked). All eight questions are solved below for completeness.

Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, object-oriented and function-oriented design, software testing, component-based software engineering, verification and validation, distributed software engineering, software evolution/maintenance; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process, testing and architecture coverage; Gamma, Helm, Johnson & Vlissides, Design Patterns — object-oriented design/reuse vocabulary.

Question 2: Software Design (20 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. The Insulin Delivery System (IDS) scenario above, with the explicit instruction to use a function-oriented (structured) design approach rather than an object-oriented one.

Find. A function-oriented design for the IDS: a data-flow decomposition of the system into its constituent processes and data stores, plus the top-down module (structure-chart) hierarchy this design implies.

Approach. Function-oriented design decomposes a system top-down into functions/processes connected by the data that flows between them (rather than by identifying real-world objects, as Question 3 does for a different system) — the standard notation for the first step is a Data-Flow Diagram (DFD), which is then refined into a structure chart showing the call hierarchy of the modules that implement each process.

Data-Flow Decomposition

Timer(periodic trigger)SensorInterfaceSugar-LevelAnalysisDoseComputationPumpActuationPatient Profile(target range, data store)SafetyMonitorAlarm(audible / visual)Patient(needle / infusion site)sample tickraw signalsugar levelinsulin dosepump drivetarget rangesugar levelcomputed doseout-of-range / faultFig. Q2 — Level-1 data-flow diagram for the Insulin Delivery System
Fig. Q2 — function-oriented (data-flow) decomposition of the IDS; processes (blue) are connected by the data that flows between them, not by object identity.

Four processes carry the main control loop, each triggered ultimately by a periodic Timer so the whole loop runs at a fixed sampling rate rather than only in response to an external event. Sensor Interface reads the raw micro-sensor signal on each tick and packages it for analysis. Sugar-Level Analysis converts that raw signal into a calibrated blood-sugar reading (applying the sensor's calibration curve). Dose Computation compares the calibrated reading against the target range held in the Patient Profile data store and computes the insulin quantity required to move the reading toward that target. Pump Actuation converts the computed dose into the drive signal that operates the miniaturized pump and needle. A fifth process, Safety Monitor, is not part of the source description's control loop but is fed the sugar-level reading and the computed dose in parallel with the main path and raises an Alarm whenever either value falls outside a safe range or the two are inconsistent with each other.

Top-Down Module Hierarchy (Structure Chart)

Refining the data-flow diagram into a callable module hierarchy under a single top-level controller gives:

Each module has a single, narrow responsibility and communicates with its caller only through its parameters and return value (no shared global state), which is the structured-design goal of high cohesion within each module and low coupling between them.

Check
Assumptions made explicit for this design: the sensor and analysis functions run on a fixed timer tick (the question does not state a sampling rate, so one is assumed to exist rather than the loop being purely event-driven); Patient Profile data (the target sugar-range and any patient-specific calibration constants) is loaded once at system start and is not itself modified by the control loop; and CheckSafety/RaiseAlarm is added as an explicit fifth process beyond the bare functional description, because a safety-critical embedded controller of this kind is expected to detect an out-of-range reading or a dose/level inconsistency and fail safe (stop dosing, sound an alarm) rather than silently keep actuating the pump on a diverging or contradictory value.