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

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.

[11 marks out of 33]

SEE NEXT PAGE

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


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]

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)

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 …

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]

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 state-independent behaviour? [14 marks out of 33]

(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]

ContinuedOver …

(c)Suppose we have the following fragment of a class diagram for a hospital administration domain:

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]

Marking Scheme:

(a) This is a Class collaboration diagram [2 marks]

The small arrows represent signals[2 marks]

The larger arrows represent operation invocations[2 marks]

Interactions via signals are asynchronous[2 marks]

Interactions via operations are synchronous[2 marks]

Signals invoke state-dependent behaviour[2 marks]

Operations calls invoke state-independent behaviour[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]