Friday, 19 May 2017
2.00 pm – 3.30 pm
(Duration: 1 hour 30 minutes)
DEGREES of MSc in Information Technology, MSc in Software Development
Software Engineering (M)
Answer All Questions
This examination paper is worth a total of 60 marks
The use of a calculator is not permitted in this examination
INSTRUCTIONS TO INVIGILATORS
Please collect all exam question papers and exam answer scripts
and retain for school to collect. Candidates must not remove exam
question papers.
CONTINUED OVERLEAF Page 1
1. This question is about design patterns and testing.
Scenario: You are developing software for a pollution monitoring device. The device measures the pollution level
once daily, stores this value, and broadcasts the result to all of the pollution services that have subscribed to
updates from the device.
a) What design pattern should be applied to represent the relationship between the pollution monitoring device
and the pollution services. Please provide the name of the pattern and a description of the problem this pattern
solves.
[6]
b) Give a UML class diagram for the proposed system. Ensure you include all the required methods and
multiplicities.
[10]
c) The system needs to be tested to ensure that pollution services can subscribe and unsubscribe to updates from
the pollution device. Write a JUnit test case that tests how pollution services can subscribe to updates.
[4]
CONTINUED OVERLEAF Page 2
2. This question is about software architectures.
a) Model View Controller is a software architecture pattern. Give a graphical representation and a description of the
role/responsibilities of the three components of this pattern.
[8]
b) Describe how Model View Controller supports software engineering design principles with three examples. For
each example, provide a distinct design principle and give a brief description of how Model View Controller adheres
to that design principle.
[6]
c) The Multilayer software architecture pattern is related to Model View Controller. Describe a key difference
between these two patterns.
[2]
d) Procedural and Sequential actions are a kind of cohesion. Describe how each type of action increases cohesion
and identify the key difference between these two types of cohesion.
[4]
END OF EXAMINATION PAPER Page 3
3. This question is about coupling and refactoring.
a) Software designers should aim to reduce coupling where possible. What are two challenges of working with
software that is highly coupled?
[4]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public class Student {
public int enrolledCredits;
public string name;
public string email;
public boolean fullTime;
public string address;
public string advisor;
public string degreeProgramme;
// Constructors and other methods…
}
public class GlobalVs {
public MAX_CREDITS = 10;
public MAX_YEARS = 5;
}
public class StudentController {
public void enrollStudent(Student student) {
if (student.fullTime && students.credits < GlobalVs.MAX_CREDITS ) { credits += 1 // Notify Student of successful enrolment String header = generateEmail(); String emailLog = prepareEmailLog(“Successful Enrolment”); String signature = addEmailSignature(); String email = header . emailLog . signature; emailStudent(Student student, String email); } else { String header = generateEmail(); String emailLog = prepareEmailLog(“Unsuccessful Enrolment”); String signature = addEmailSignature(); String email = header . emailLog . signature; emailStudent(Student student, String email); } } } b) Review the partial code sample above. Identify four examples of coupling by providing the type of coupling present, a description of what the coupling is, and the line numbers where it is present in the code. [12] c) Select two of your examples from part b of this question and describe how you would reduce this kind of coupling. [4]