CS/387/?/????
1
UNIVERSITY OF SURREY ©
BSc Undergraduate Programmes in Computing
BSc Undergraduate Programmes in Mathematical Studies
Level 3 Examination
Module CS387 – THE MODELS ARE THE CODE – EXECUTABLE UML
Marking Scheme
Time allowed - 2 hours
Autumn Semester 2005
Attempt ALL THREE questions.
SEE NEXT PAGE
CS/387/?/????
2
1:
(a) What are the four class relationship types that are supported in Executable UML
(xUML)?
[4 marks out of 33]
(b) Provide four example class diagrams; one to illustrate each of the four relationship
types. Make sure that you annotate the associations according to our modelling
guidelines.
[16 marks out of 33]
(c) xUML does not support the aggregation relationship type. Why not?
[2 marks out of 33]
(d) In a test procedure for silicon wafers, an Inspection Script consists of a sequence of
“Steps”. The following diagram uses aggregation to model this part of the testing
application domain. Modify this to provide a model that complies with the xUML
modelling guidelines. In addition, further modify the diagram to make sure the
“sequence” relationship between steps is captured.
InspectionScript
Step
[11 marks out of 33]
SEE NEXT PAGE
CS/387/?/????
3
Question 1 – marking scheme
(a) 1 mark each for: Binary non-reflexive; Binary reflexive; Association class;
Generalisation (or inheritance).
(b) For each of the four examples:
1 mark for a correct representation of the respective relationship type
1 mark for correct use of verb phrases
1 mark for correct use of multiplicities
1 mark for labelling the association with an identifier
(c) 1 mark for mentioning imprecision/vagueness, 1 mark for mention the greater
expressive power obtained through the use of verb phrases
(d) Refering to the diagram below, three marks for the basic structure including the
addition of the binary reflexive association on “Step”. Then for each association:
1 mark for a correct representation of the respective relationship type
1 mark for correct use of verb phrases
1 mark for correct use of multiplicities
1 mark for labelling the association with an identifier
InspectionScript
1
is in
R1
1..*
contains
Step
0..1
executes before
executes after
0..1
R4
CS/387/?/????
4
2: The diagram below shows part of a statechart for a Door class in a lift-system application.
However, this statechart does not include the behaviour for the situation where the door is
obstructed.
a) First of all, explain the difference between Active Classes and Passive Classes. Which
kind is the Door class?
[6 marks out of 33]
b) Modify the statechart to include appropriate behaviour in the case where the door is
obstructed. Be sure to include short textual descriptions of the entry actions of any
states you introduce. However, you do not need to provide Action Language
descriptions.
[14 marks out of 33]
c) As discussed in the lectures, this is not a complete model. Briefly describe why this is
so, and then illustrate a method for producing a complete description of the state
behaviour.
[13 marks out of 33]
1. Open
entry/
// stop opening the door
4. Opening
doorFullyOpen
en
entry/
// Start opening the door
closeDoorRequest
openDoorRequest
2. Closing
entry/
// Start closing the door
3. Closed
doorFullyClosed
entry/
// Stop closing the door
// Tell the lift it is now
// safe to move
CS/387/?/????
5
Part (a)
The behaviour of instances of active classes (“active objects”) varies over time. [2 marks]
Passive objects have the same behaviour at all times [2 marks]
Door in this case is an active class [2 marks]
Part (b)
1. Open
entry/
// stop opening the door
4. Opening
doorFullyOpen
en
entry/
// Start opening the door
closeDoorRequest
openDoorRequest
2. Closing
entry/
// Start closing the door
3. Closed
doorFullyClosed
tryAgain
entry/
// Stop closing the door
// Tell the lift it is now
// safe to move
doorwayObstructed
5. AvoidingObstruction
entry/
// Stop closing the door
// Start opening the door
6. ObstructionAvoided
doorFullyOpen
entry/
// Stop opening the door
// Pause
// enerate tryAgain to this
Correct redrawing of original state chart [1 mark]
Addition of “AvoidingObstruction” state [3 marks]
2 marks each for respective entry actions [4 marks]
Addition of “ObstructionAvoided” state [3 marks]
One mark for each correct new association with event [3 marks]
Part (c) over …
CS/387/?/????
6
Part (c)
The state chart does not explicitly represent all state-event combinations
[1 marks]
Mention of the need to use a state-transition table
[2 marks]
Correct illustration of a STT with Signals along the top and State on the l.h.s
[6 marks]
Mention of “Connot Happen” entries
[2 marks]
Mention of “Ignore” entries
[2 marks]
CS/387/?/????
7
3:
(a) The diagram below contains two kinds of arrows. What kind of diagram is this,
and what do the two kinds of arrows represent?
Which are synchronous and which are asynchronous events?
Which events invoke state-dependent behaviour, and which invoke stateindependent behaviour?
[14 marks out of 33]
<<interface>>
Administrator
admitPatient dischagePatient
returnCaseNotes
:Patient
<<interface>>
Location_Tracking
requestCaseNotes
patientAdmited
patientDischarged
releaseBed
patientNowInBed
:Bed
(b) The figure below is an example of an “anti-pattern” – something to be avoided.
What is the basic mistake that the analyst has made in coming up with this state
model? How could this “arachnid” like model be simplified?
[8 marks out of 33]
4. Operation3
entry /
# do operation3
Generate S1:operationComplete () to this
1. Operation5
entry /
# do operation 5
Generate S1:operationComplete () to this
opComplete( )
doOp5( )
opComplete( )
doOp3( )
5. Idle
entry /
# just wait around for the next thing to do
opComplete( )
doOp1( )
2. Operation1
entry /
# do operation 1
Generate S1:operationComplete () to this
opComplete( )
doOp2( )
3. Operation2
entry /
# do operation2
Generate S1:operationComplete () to this
Continued Over …
CS/387/?/????
8
(c) Suppose we have the following fragment of a class diagram for a hospital
administration domain:
Patient
Bed
is occupied by
patientId {I}
is using
0..1
1
bedId {I}
R1
A Bed may be in one of two states: Bed Available; Bed Unavailable. How would an
instance of a PatientAdministrator class notify an instance of Bed class that a patient
had been assigned to it? Draw a simple statechart for Bed to show how an Available
instance of Bed should respond to this notification.
[11 marks out of 33]
CS/387/?/????
9
Marking Scheme:
(a) This is a Class collaboration diagram
The small arrows represent signals
The larger arrows represent operation invocations
Interactions via signals are asynchronous
Interactions via operations are synchronous
Signals invoke state-dependent behaviour
Operations calls invoke state-independent behaviour
[2 marks]
[2 marks]
[2 marks]
[2 marks]
[2 marks]
[2 marks]
[2 marks]
(b) The analyst has used a state model to capture state-independent behaviour
[4 marks]
This behaviour should be captured as operations, and not as responses to signal
events.
[4 marks]
(c) The Patient Administrator needs to generate a signal with the identifier of the
respective patient passed as an event parameter.
[3 marks]
This signal must have the same name as that which causes the transition from Bed
Available to Bed Unavailable
[2 marks]
Check the state machine has two states and that entry into the Bed Unavailable state
causes a link to be established between “this” bed and the Patient whose Id has been
passed as a parameter. The link should be set up as:
select any patient from instances of Patient
where selected patientId == rcvd_event.patientId;
relate patient to self across R1;
[6 marks]
© Copyright 2026 Paperzz