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.
Applying the standard object-oriented heuristic of extracting candidate objects from the nouns of the problem description (diary, appointment, co-worker/user, time slot, request) and merging duplicates gives the following object model.
Person represents a co-worker and holds their normal working hours (used to keep proposed slots inside working hours). Each Person owns exactly one Diary, an aggregate of DiaryEntry objects; a DiaryEntry is marked either fixed (cannot be moved — e.g. an external commitment) or movable (the owner is willing to reschedule it), which is the key attribute that later drives the rearrangement logic. When a group appointment is wanted, a MeetingRequest is created holding the list of participants, the desired duration, and an acceptable date range; its findCommonSlot() operation queries every participant's Diary for free slots and intersects them. If the intersection is non-empty, the earliest common slot is booked directly as an Appointment referencing that slot and the full participant list. If no common slot exists, negotiateReschedule() hands control to a RescheduleAgent, which examines each participant's movable DiaryEntries near the desired time and proposes swaps (proposeSwap(entry)) back to the affected user for confirmation, re-running findCommonSlot() once a movable entry has actually been relocated.