25-Comp-A6 Software Engineering · December 2016
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
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 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.
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.
Refining the data-flow diagram into a callable module hierarchy under a single top-level controller gives:
ReadSensor() — implements Sensor InterfaceComputeSugarLevel(rawSignal) — implements Sugar-Level AnalysisComputeInsulinDose(sugarLevel, patientProfile) — implements Dose Computation, reads Patient ProfileActivatePump(dose) — implements Pump ActuationCheckSafety(sugarLevel, dose) — implements Safety Monitor, calls RaiseAlarm(reason) on failureEach 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.
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.