College of Science, Engineering and Technology
⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄
COS3711: Advanced Programming
Assignment 4 | Year Module, 2026
⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄
COS3711
Module Code:
Advanced Programming
Module Name:
Rainfall Tracking Application: Design and
Assignment Topic:
Implementation
Assignment 4
Assignment Number:
80
Total Marks:
Submitted in partial fulfilment of the requirements for Advanced Programming, UNISA 2026
, UNISA | COS3711 Advanced Programming — Assignment 4
e
Question 1: System Design
The rainfall-tracking scenario describes a container holding rainfall observations, a component that
renders that data as an XML document, and a family of interchangeable graph renderers that con-
sume the XML. A clean object-oriented design separates these three concerns and lets the Clien-
t/GUI class coordinate between them without any single class knowing the internal detail of an-
other.
1.1 Partial UML Class Diagram
Four responsibilities emerge directly from the scenario. RainData stores one observation (station,
date, amount). RainRecord is the container that aggregates many RainData objects. RainXml
is solely responsible for converting a RainRecord into the XML format required by the graphing
applications, and is implemented as a singleton since only one XML-generation service is needed
application-wide. Graph is an abstract base that defines the interface every graph type must hon-
our, with BarGraph and ColumnGraph as concrete strategies. The Client class owns the RainRecord,
requests the XML representation from RainXml, and forwards it to whichever Graph the user se-
lected.
1.2 Is the Pattern Behavioural?
The claim needs qualifying rather than a flat yes or no, because the scenario actually calls for two
separate patterns operating in different parts of the design. Choosing between a bar graph and a
column graph at runtime, while keeping both behind one Graph interface, is the Strategy pattern,
and Strategy is correctly classified as behavioural because it is concerned with how an algorithm
is selected and executed, not with how an object is created or how classes are composed struc-
turally. However, the single shared point of access used for XML generation (RainXml) is a Single-
ton, which is a creational pattern since its concern is controlling object instantiation, not runtime
behaviour. So the statement is true only for the graph-selection part of the design; it does not hold
for the XML-generation part.
1.3 Reflective RainData Class
Qt’s meta-object system can still invoke a private slot through QMetaObject::invokeMethod()
even though ordinary client code cannot call it directly, which is exactly the restriction the question
Page 2 of 11