THE UNIVERSITY OF HONG KONG
FACULTY OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE
COMP3297 Software Engineering
Date: December 10, 2020
Answer ALL questions.
If you need to make assumptions, please state them clearly in your answers. Total mark for the paper is 100.
Time: 2:30pm-5:30pm
Candidates are permitted to refer to the following electronic/printed materials in the examination: books, lecture and tutorial slides, project materials, exercise handouts and sample solutions, and self- made notes. Internet searching is NOT allowed.
Candidates are not permitted to communicate with others. Use of a calculator is not allowed.
Instructions to candidates concerning preparation and submission of answers:
You can write answers on paper, single-sided, and capture them in electronic form for submission. Or you can use a computer/tablet and appropriate software to type/write your answers. Or you can use a combination of methods.
You may write in pencil, but it is your responsibility to ensure that your answers are legible. Black pen is preferred.
To submit your answers, assemble them into a single PDF file in order of question number and submit the file to OLEX.
Ensure your University Number and the course code, COMP3297, are included on the first page of your answer script.
Before submitting the file containing your answers to the OLEX system, check that it includes all your answers and that they can be read clearly when opened.
P. 1 of 7
Not for circulation.
Questions 1 to 5 all refer to the following case.
OutbreakSentry: A system for infectious disease surveillance using search queries.
Research has shown a strong correlation between emerging infectious disease events and the frequencies of internet search queries related to the diseases involved. For instance, query data from Baidu, Google, Bing and similar search engines show that searches for terms such as “dengue symptoms”, “dengue treatment”, “dengue fever prevention”, and “breakbone fever symptoms” from a geographical region give an early indication of an outbreak of dengue fever in that region.
An international public health agency requires a pilot web-based system, OutbreakSentry, to assess the effectiveness of exploiting internet search queries to give early warning of local outbreaks of infectious diseases.
OutbreakSentry will analyse search queries and identify those containing search terms that match those known to correlate with outbreaks of the related disease. For each matching query, the system will record the date and time of the query, the full text of the query, and the originating IP address. OutbreakSentry will use a 3rd party IP Address Geolocation Lookup service to obtain details of the originating location. Details recorded for locations are: City (if available), Region, Country, Latitude and Longitude. Issues related to use of VPNs, etc., resulting in misidentification of the true geographical origin of a search are not thought to be significant.
Release 1 of OutbreakSentry will provide the following features:
o Allow users to add, and maintain data for diseases monitored by the system:
§ record and maintain a name for the disease. Example: “Dengue fever”
§ record and maintain a short description for the disease. Example: “Acute mosquito-borne tropical and sub-tropical disease caused by the dengue virus”.
§ record and maintain search terms to be used for surveillance. Example: “dengue symptoms”. Note: in the pilot system, each search term is unique and relates to a single disease.
o Analyse search queries as described above and record details for those that contain a search term of interest.
§ Note: In Release 1, when a query contains more than one search term of interest, only the first term is processed. All others are ignored.
o Obtain and record details of the originating location of each query that contains a search term of interest.
§ Note: OutbreakSentry will not maintain duplicate records of any location.
o Allow users to view details of locations which are currently the source of unusually high numbers of
searches related to any of the diseases monitored by the system. Release 2 of OutbreakSentry will add or modify features as follows:
o Allow users to link a disease to other diseases maintained by the system. Some diseases are often confused with other diseases that have similar symptoms. Searches related to one disease may actually indicate an outbreak of another. Example: Chikungunya infections are often confused with dengue fever.
o Record a weighting for each search term. As data on the strength of correlations between searches and outbreaks become available, higher weighting will be given to search terms that correlate more strongly with outbreaks.
o When a query contains more than one search term of interest, all search terms are processed.
o Allow users to select a disease and view a visualization of locations of possible outbreaks based on
surveillance results for that disease and for all diseases commonly confused with it. P. 2 of 7
1. [10%] Domain Modelling
a) Based on the information supplied, construct a domain model illustrating conceptual classes, associations and attributes for Release 1 of OutbreakSentry.
b) Show the modifications to your model required for Release 2 of OutbreakSentry. You do not need to redraw the entire model. Draw only those parts that will change for Release 2.
2. [15%] Requirements Engineering: User Stories
Consider the following scenarios for Release 2 of OutbreakSentry. Scenario 1:
– A logged-in member of agency staff (the user) selects to add a new disease to be monitored by the system and provides details of the disease.
– The system warns that there is already a disease with a similar name known to the system. (Example: when adding dengue fever, the user will be warned if the system is already monitoring dengue haemorrhagic fever).
– The user chooses to proceed and provides the search terms to be monitored for the disease.
– The system warns that one of the search terms is already known to the system and prevents the user
from adding it. The user removes the search term from the set they provided.
– The system confirms the successful addition of the new disease and starts monitoring its search terms.
– The user selects to link the disease to another disease already monitored by the system and with which it is commonly confused.
– The system confirms the successful linkage. Scenario 2:
– A logged-in member of agency staff (the user) selects to add a new disease to be monitored by the system and provides details of the disease.
– The system warns that there is already a disease with the same name known to the system and prevents the user from adding it.
Write a user story or stories to represent the required functionality to support the two scenarios. For each story, include a Confirmation section that lists conditions of satisfaction.
3. [15%] User Interface Design and Prototyping
Design a UI to support the scenarios in the previous question, Q2. Your UI should also support the obvious variants – for example, the variant in which the staff member chooses to abandon adding a new disease after being warned that a disease with a similar name is already known to the system.
a) Sketch a series of wireframe prototypes to represent your design. Provide sufficient details of navigation for your set of wireframes to serve as a rough storyboard.
b) For your design, give your two best examples of following Adobe’s 4 Golden Rules of UI Design.
P. 3 of 7
4. [6%] Django Model Design
You will implement OutbreakSentry in Python on Django.
Based on your Domain Model in Q1.a, define Django model classes for Release 1 of OutbreakSentry, showing only their fields that establish relationships with any other of your model classes. A relationship could be defined, for example, by a ManyToManyField, a ForeignKey, or a OneToOneField.
You are not required to define methods, or include fields that do not establish a relationship with another of your classes. Your class definitions will be very short.
5. [14%] Agile Project Management
You are a member of the team that will develop OutbreakSentry. Your team is similar in size and level of experience to your HotZone project team and will use Scrum as its process framework.
You have taken responsibility for recommending the project management tools for the project. On the basis of your experience using Jira in the HotZone project, consider whether you would recommend it for OutbreakSentry rather than traditional alternatives such as shared spreadsheets and an actual taskboard, or any other tools with which you have experience.
a) Although choice of project management tools is not a technical issue, a Technical Memo provides a useful format for documenting and justifying your recommendation. Write a Technical Memo to summarize your project’s needs in terms of tool support for project management, what tool(s) you recommend and the reasons why, and the alternative(s) you rejected and the reasons why.
Several weeks have now passed and you are partway through OutbreakSentry development. You are developing in fixed-length sprints. You estimated that your Product Backlog contained 185 story points of PBIs at the start of the project – that is, at the start of Sprint 1.
Your team developed and delivered 25 story points of PBIs in Sprint 1.
During the Sprint Review in Sprint 1, it became clear that a certain low priority PBI in the Product Backlog was out of scope for the project. The size of the PBI was 13 story points and it was incorrectly added to the Backlog at the start of the project. You removed it before Sprint 2.
In Sprint 2 your team developed and delivered 18 story points of PBIs, 23 story points in Sprint 3, and 14 story points in Sprint 4.
b)
Calculate your team’s average velocity over the first four sprints of the project and assume that the team maintains that velocity until the Backlog is completely burned down.
i) ii)
iii)
If there is no further change in scope after the incorrect PBI was removed, how many sprints in total will the project require?
In the Sprint Review at the end of Sprint 5, it is agreed that a certain feature in the Product Backlog is no longer required and the project scope is reduced accordingly. The feature’s size was estimated to be 16 story points. Assume there will be no further change in scope in Sprint 6 and beyond. After which sprint will the project now be complete?
After scope was reduced in Sprint 5 you assume that, to reduce costs further, there will be the same reduction in every subsequent sprint – that is, in Sprint 6 and beyond. After which sprint will the project be complete?
P. 4 of 7
6. [12%] Software Process
a) In the HotZone project, your team took an Agile approach to development. Your process adopted many of the principles of Scrum, but didn’t follow all of Scrum’s rules.
i) list three elements or principles of Scrum that you did not adopt for HotZone development. For each, discuss whether or not adopting it would have improved your process.
ii) list three elements or principles of Scrum that you did adopt for HotZone development. For each, discuss whether it provided any benefit for your project.
b) The Scrum Guide states that one element of a Sprint Review is a discussion of “…what went well during the Sprint…”. It also states that a purpose of a Sprint Retrospective is to identify “…the major items that went well…”.
What is the difference between these similar-sounding elements of the two events?
c) It is suggested that one way to prevent Technical Debt from escaping a sprint and accumulating in a codebase is to strengthen the project’s Definition of Done.
i) Explain why carrying high levels of Technical Debt in a codebase is generally considered undesirable.
ii) Explain how the Definition of Done can prevent accumulation of such debt. Illustrate your answer by giving three examples of items in a Definition of Done that could serve this purpose.
7. [10%] Version Control and Deployment Strategies
a) Assume your HotZone team will continue to develop and deliver the full-scale HotZone system for CHP. For each of the following integration or deployment strategies, summarize the strategy and explain whether it would be suitable and/or beneficial for the full-scale HotZone project.
i) Continuous Integration.
ii) Continuous Delivery.
iii) Continuous Deployment.
iv) Gradual roll-out via canary servers or ring-based deployment.
b) We saw that Microsoft, among others, uses Feature Flags to avoid the need for long-lived feature branches. Google uses the same technique to allow developers to work directly on trunk and completely avoid having feature branches. Explain how Feature Flags are used for this purpose.
c) In GitFlow and OneFlow, release branches are eventually merged back into the development branch. However, in Release Flow and in Google’s google3 repo, release branches are simply deleted. Explain the reasons for this difference in the way release branches are handled.
P. 5 of 7
8. [18%] Coverage and Automated Testing
The following code is extracted from an open-source Django app for managing real-world libraries. It shows part of the Loan model class. All methods and fields that are not required for this question have been removed. For instance, foreign keys that link to the item loaned and to the library user who borrowed it are not shown.
# In models.py
from django.db import models
from datetime import date
class Loan(models.Model):
date_due = models.DateField()
date_returned = models.DateField(blank=True, null=True) daily_fine = models.SmallIntegerField(default=0)
# *** Defective code ***
def get_fine(self):
if self.date_due < date.today():
if not self.date_returned:
return self.daily_fine * (date.today() - self.date_due).days
elif self.date_returned > self.date_due:
return self.daily_fine * (self.date_returned – self.date_due).days
else:
return 0
The get_fine() method is used to determine the fine, if any, associated with a current or past loan. get_fine() is required to return:
· 0 if the item was returned to the library on or before its due date;
· 0 if the item is not yet overdue;
· the current total fine, if the item has not yet been returned and is overdue. It is calculated as the daily
fine in HKD multiplied by the number of days currently overdue;
· the total fine, if the item has been returned but was late. It is calculated as the daily fine in HKD
multiplied by the number of days the item was overdue when it was returned.
a) Demonstrate the weakness of full statement coverage as a test adequacy criterion, as follows:
i) Write a test class, TotalFineTest(TestCase), to support automated testing of the get_fine() method, where TestCase is Django’s django.test.TestCase. Your test method(s) should provide full statement coverage of get_fine() but fail to reveal the defect.
ii) Write an additional test method which, when executed together with your test method(s) in (a), will provide full branch coverage of get_fine() and will reveal the defect.
b) Structural coverage is often used as an adequacy measure of a functional test set with respect to the functional requirements. Explain each of the following:
i) Why complete functional coverage should imply full statement and branch coverage.
ii) Why full statement and branch coverage does not necessarily imply complete functional coverage.
P. 6 of 7
Appendix to Q8 DateField and datetime information
Django’s models.DateField represents a date as a Python datetime.date instance.
Python’s datetime.date has 3 attributes: year, month, and day. You can create an instance by calling the
constructor with three arguments, all of which must be integers: datetime.date(year, month, day). Example: exam_date = datetime.date(2020, 12, 10)
The classmethod date.today() returns the current date.
A date instance before or after a particular date can be created by subtracting or adding a datetime.timedelta instance representing the difference between the two dates. timedelta is a class in Python’s datetime module and an instance of the class represents a duration of time. For a timedelta of days, all that is required is to supply the number of days as an argument to the timedelta constructor.
Example: yesterday = datetime.date.today() – datetime.timedelta(days=1)
The number of days represented by a timedelta object can be accessed through its days instance attribute.
—-END OF PAPER—–
P. 7 of 7