THE UNIVERSITY OF HONG KONG
FACULTY OF ENGINEERING
DEP ARTMENT OF COMPUTER SCIENCE
CSIS0297/COMP3297 Introduction to Software Engineering
Date: December 19, 2014 Time: 9:30am – 12:30pm
Only approved calculators as announced by the Examinations Secretary can be used in this examination. It is the candidates’ responsibility to ensure that their calculator operates satisfactorily, and candidates must record the name and type of the calculator used on the front page of the examination script.
Pencils may be used for diagrams.
I f you need to make assumptions, please state them clearly in your answers.
Answer ALL questions. (100%) Use UML 2 for all diagrams.
P. 1of5
Not to be taken away
1. (20%) Analysis Modelling
Consider a train door controller. Its responsibility is to respond to signals from buttons and sensors and send requests to actuators to open and close a train carriage door in a safe manner. The controller receives signals from:
door buttons. These are buttons both inside and outside the door. They are pressed by passengers who wish to open the door to enter or leave the carriage.
– obstacle sensors. These sensors detect ifthere is any obstacle in the doorway. For example, if doors are closing and a passenger tries to enter, the obstacle will be detected by the sensor.
limit sensors. These detect when the door has reached the limit of opening or the limit of closing.
– platform sensor. This sensor signals when the train is at a platform.
speed sensor. This sensor monitors the speed of the train.
The door starts in a closed state. The controller will open the door in response to a button press only ifthe train is stopped and it is at a platform. To open the door, the controller sends a continuous open command to the actuator until the limit sensor indicates that the door is fully open. At that point the controller stops sending the open command.
The controller will allow the door to stay open until a timeout (currently 10 seconds) is received. At that point the controller will close the door. It closes the door by sending a continuous close request to the actuator until the limit sensor indicates that the door is fully closed. At that point the controller stops sending the close command. While the door is closing, the controller commands a warning alarm to sound. Again, this request is made continuously until the door is fully closed.
If, while the door is closing, either an obstacle is detected or the button is pressed, then the controller will open the door again. This is done in the same manner as described above.
The train is prevented from moving while the door is not closed and so the train will remain stopped at least until the door is again fully closed.
a) Draw a UML state machine diagram to model the behaviour ofthe controller. Name the states to correspond to the state of the door. For example, the first state will be “Closed”.
b) Draw a second state machine diagram to illustrate how the door controller and the train’s main engine controller can be synchronized through guard conditions such that the train will remain stopped while the door is open.
2. (10%) Software Process Models
a)
b)
c)
What are the principal features of iterative and incremental process models such as the Unified Process (UP) that differentiate them from the Traditional Life Cycle (Waterfall) model?
Explain how those differences allow projects to avoid difficulties, such as late-design breakage, that are often experienced by projects that use the Waterfall.
Despite its limitations, the Waterfall may still be a good choice under certain circumstances. Outline those circumstances and give an example of the sort of project for which the Waterfall could be an acceptable process model.
P. 2 of 5
3. (18%) Requirements Engineering
Consider the following extract from a use case description. It was produced in the early stages of requirements engineering and, therefore, is written in essential style. It belongs to the use-case model of a system which will help supermarket employees manage product information. The extract contains several defects.
a) b)
c)
I0. System confirms successful update
Extensions:
4a. The product is not found:
I. Manager cancels operation and use case ends
Remaining sections omittedfor brevity
Review the use case and report any defects. For each defect, explain the problem you have identified.
Write a new version ofthe use case with the defects corrected. Underline or highlight the changes you make. (Ignore sections that were omitted from the original).
Draw a System Sequence Diagram for the main success scenario of your new version of the use case.
**************NOTE: THIS IS A DEFECTIVE EXAMPLE***********
Use Case Name: Use case for Products Administrator to change the price of a product manually. Scope: Supermarket Stock Management System (SSMS)
Level: User goal
Primary Actor: Products Administrator
Stakeholders and Interests: No relevant stakeholder for this use case
Preconditions:
Desktop machine running Microsoft Windows 8.1 with connection to SSMS server SSMS installed on server
Products Administrator is identified and authenticated
Product exists in database
Success Guarantee (Postconditions): Product price updated
Main Success Scenario:
I. 2. 3. 4. 5. 6. 7. 8. 9.
An incorrect price must be corrected
Manager navigates to products area
Manager enters correct Universal Product Code for product
System displays product description
Manager double-clicks the product description
System displays all details ofthe product
Manager enters new price
Manager clicks “OK” button
System generates SQL UPDA TE statement to modify the Products database table
P. 3 of5
4. (22%) Use-case Realization
Learning Commons Same-Day Reservation System
Given the popularity of group discussion rooms in the Learning Commons, the University will construct a further set to be available for short term use. The new rooms can be reserved only one day in advance. Rooms currently without reservations are also available for walk-in use. The University requires a system to manage the room reservations.
The system will maintain a list of currently enrolled students including, for each student, the student’s name, email address and University Number. The University Number uniquely identifies a student.
Each room has a unique identifier. Rooms are available in 1hour timeslots. A student may request to reserve a room for the next day by providing his/her University Number and the required time. I f a room is available, the reservation will be made. Reservations are limited to one 1 hour timeslot . Longer periods require multiple reservations.
There is a second type ofreservation for walk-in students. A walk-in student is a student, already in the Commons, who does not have a reservation and who requests a room for the current timeslot. I f a room is available, the student may use it until the end ofthe current timeslot without providing a University Number- a reservation is made to show that the room is no longer available, however no student details will be associated with walk-in reservations.
The system is also required to display the available or reserved status o f any given room for any timeslot during the current or next day.
The system will run on a dedicated PC and will be used by a member of University staff to make and manage reservations in response to requests from students.
a) Suggest a set of conceptual classes for the room reservation system and construct a domain model illustrating those conceptual classes, together with their relevant attributes and associations. Show multiplicities clearly.
Consider a Make Reservation use-case. This describes how a member of University staff uses the system to make a reservation for a student. It begins when the user enters the details of a reservation request and ends when the reservation has been made successfully and the system has informed the user. Design a realization of the main success scenario of this use-case. Limit your design to the Domain layer. You are not required to provide a use-case description. Note that the main success scenario does not deal with walk-in reservations.
b) Construct a sequence diagram to illustrate the interactions in your design.
5. (10%) Architectural Design
a) A very common approach to architectural organization is to break software into coarse-grained packages with clear responsibilities and to organise them in a layered hierarchy. Describe how organising an architecture in this way can help achieve the following general design goals:
(i) Keep the level ofabstraction as high as possible; (ii) Increase cohesion where possible;
(iii) Reduce coupling where possible.
b) What are the benefits of achieving each of the three design goals listed in (a) above?
P. 4 of5
6. (20%) Software Testing
A course uses a final examination to assess whether students pass or fail the course. The exam consists of two multiple choice papers, A and B. The papers are marked automatically and the pass mark for each paper is 25 out of a possible 50. If a student passes either paper A, paper B, or passes both, then that student passes the course. Otherwise the student fails. Thus, only students who fail both papers will fail the course.
The marking machine contains a software component that, given two marks, A and B, for a student, will classify that student as Pass or Fail. The machine guarantees that the mark for each paper will be an integer in the range [O, 50] and so the component will never be exposed to invalid or out-of-range input.
You are responsible for testing the component and are required to use standard equivalence class partitioning and boundary value analysis to specify a set of test cases.
a) Identify and list the equivalence classes and boundary values that must be tested. You may make the single fault assumption.
b) Based on your answer to (a), specify a set oftest cases. For each test case, indicate all equivalence classes and boundary values covered by the case.
c) I f you used only equivalence class partitioning to specify test cases (still making the single fault assumption), could you cover the equivalence classes adequately with two test cases: one probing the region where both A and B are< 25, and the second probing the region where both A and B are>= 25? Explain in detail.
d) I f you used only equivalence class partitioning to specify test cases and did not make the single fault assumption, how many test cases would you need to cover the equivalence classes adequately?
e) Ifyou have access to the code ofthe component you could apply white-box (structural testing) instead of black-box techniques. Outline the differences between black-box and white-box testing and describe the dangers ofrelying on a white-box approach as the sole basis for test-case design.
f) In the case of the component, suggest a type of defect that would not be revealed by a pure white-box approach, yet which could be revealed by black-box testing.
—-END OF PAPER—–
P. 5of5