25-Comp-A6 Software Engineering · December 2017
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — December 2017 — 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, real-time software engineering, requirements engineering, software reuse, software quality management; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process and testing coverage.
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.
Function-oriented design decomposes a system top-down into a hierarchy of functions (procedures) that transform input data into output data, typically documented as data-flow diagrams and structure charts. Data is treated as a separate, often shared or global, resource that flows between functions; the functions themselves are the primary unit of decomposition and reuse. Object-oriented design instead decomposes the system into objects, each of which bundles together a piece of state (its attributes) and the operations that are allowed to act on that state, and objects collaborate by sending each other messages (calling one another's operations) rather than by all reaching into a common pool of data.
The practical consequence is that function-oriented systems are easy to reason about for simple, well-defined data transformations (batch reports, numerical pipelines) but scale poorly as systems grow: because state is shared, a change to a data structure's representation can ripple through every function that touches it, producing the classic "change amplification" problem. Object-oriented design's information hiding — each object exposes only an interface and hides its internal representation — localizes the impact of a representation change to the object itself, and its support for inheritance and polymorphism gives a natural mechanism for extending and reusing behaviour. The trade-off is that object-oriented designs generally require more up-front design effort to identify the right objects and their responsibilities, and the extra layer of indirection (message passing between many small objects) can make the control flow of the finished system harder to trace by eye than a single top-down function hierarchy.
The HSS decomposes naturally into input-handling, decision, storage and output/actuation functions, each an independent module communicating through explicit data and control flows rather than shared state.
Sensor Input Handler polls (or receives interrupts from) the entry, smoke, temperature and flood sensors and normalizes each raw reading into a common internal representation. Keypad Input & Programming handles owner interaction with the keypad, including PIN-gated access to programming mode, and writes owner-set thresholds, phone numbers and alarm delays into the Configuration Store. Threshold Monitor is the core decision function: on every sensor update it compares the reading against the configuration store's thresholds (allowing for the programmed delay before an alarm is declared, e.g. an entry delay to allow disarming) and raises the appropriate event. Alarm Controller, Light Controller and Auto-Dialer are independent output functions triggered by Threshold Monitor events, each responsible for one physical actuation (siren/alarm, selected lights, and dialling the owner's programmed numbers in sequence until one is answered or the list is exhausted).