Assignment 2 - Solutions
pdf
keyboard_arrow_up
School
University of Ottawa *
*We aren’t endorsed by this school
Course
3101
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
15
Uploaded by MasterPenguin3880
Assignment #2
SEG3101 / Fall 2022
1/15
SEG3101 – 2022: Assignment # 2
To be done with your group (identify the members who participated). This 100-point
assignment counts for 5% of your final grade. There are also 20 bonus points in this assignment.
For UML, the use of modeling tools is not required here. However, tools such as PlantUML can
help avoid costly syntax errors. Submit your answers (PDF) via Brightspace, no later than
December 1st, 10:00pm
. But do not wait and finish this assignment on a haste by leaving it
until the last day!
Q1. Modeling lifecycles (25 marks)
You shall model the lifecycle of an
application
of a university graduate program at uOttawa. In
this context, please assume that:
1.
Once created on the Ontario Universities Admission Centre (OUAC), an application
needs to be verified for completeness.
2.
An incomplete application may require additional information from the student (a
university transcript, the results of an English/French test, etc.).
3.
For each application received (complete or not), OUAC also contacts two of the referees
listed to obtain their letters of recommendation.
4.
Once evaluated, a complete application (including the letters) is usually either accepted
or rejected.
5.
The evaluation of an application may however also be postponed if the decision would
be too close to the beginning of the next semester.
a)
Draw a
UML state machine diagram
to model the lifecycle of an application that minimally
covers the points above (and probably other points that make sense). Clearly document the
transitions (
events [conditions] [/ actions]
). Use hierarchical states and concurrent regions if
they can simplify your model. You can use Java variables and methods, but make sure they
are well documented (data types and descriptions) and used consistently in your conditions
and parameters. (
20 marks
)
In the following, the variables are:
•
allStudentInfo (Boolean): true iff all the required student info (transcript, language test,
etc.) have been received.
•
allRecLetters (Boolean): true iff the required letters from both recommenders have been
received.
•
tooClose (Boolean): true iff the current date is such that the decision would be too close
to the beginning of the next semester.
•
acceptable (Boolean): true iff the student is found admissible.
Functions returning such variables could also have been defined.
Note the use of parallel substates here (as these things happen concurrently and are independent),
and the use of short-circuiting transitions in these substates. Both parts need to be in the end
pseudo-state for taking the implicit group transition to Complete.
Assignment #2
SEG3101 / Fall 2022
2/15
This diagram was “coded” with PlantUML (see code in the zip file).
Assignment #2
SEG3101 / Fall 2022
3/15
b)
Describe your assumptions, in English, regarding ambiguities or incompleteness issues in
the description given above. Make sure your state diagram implements your decisions. (
5
marks
)
•
It is assumed here that the application must be in one of these states, for statistics purpose
(and hence there is no end pseudo-state after accepted or rejected).
•
It is assumed that a postponed evaluation will be evaluated the next semester.
•
It is assumed that missing information is requested and checked until everything is there.
•
Some important methods for communication with recommenders and students (to ask for
more info or to report on the status/verdict of the application) have been identified.
•
A rejected application is not reopened. A new application must hence be created and
evaluated.
Q2. Domain Modeling with UML Class Diagrams (25 marks)
You are asked to produce a precise domain model for a
finite state machine (FSM)
modelling
language in order to produce a modelling tool. In that FSM language, we want to represent,
minimally, the following concepts (please stick to the description below; do not extrapolate
based on prior knowledge of FSMs or UML).
1)
Each state has a name, which is unique within the scope of a diagram. There are three
special types of states (beside normal ones): start states, end states, and super states.
2)
A start state has a precondition (String) whereas an end state has a postcondition
(String).
3)
A FSM model contains at least one FSM diagram.
4)
A FSM diagram:
a)
Has a name and a description.
b)
Is composed of states and of transitions.
c)
Has exactly one start state, and may optionally have end states.
5)
Transitions connect pairs of states that belong to the same diagram:
a)
A transition has a name.
b)
A transition has a source and a destination state.
c)
A transition can neither have a start state as destination nor an end state as source.
d)
No state can exist without at least one transition.
6)
A super state references another FSM diagram
a)
A super state can only have one input transition and one output transition.
b)
The referenced FSM diagram must have at least one end state.
c)
A FSM diagram may be referenced by many super states.
(a) Draw a
UML class diagram
describing your domain model. Please include appropriate
classes (enumeration, abstract or concrete), their attributes (including UML types), and
associations (with directions, multiplicities, compositions, and role names). No need to describe
the
operations
or
visibility
(-,
+,
#)
of
attributes/roles.
Be
precise!
(
19
marks
)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Assignment #2
SEG3101 / Fall 2022
4/15
Note: There is always a tradeoff between what we can show with associations/multiplicities and
what can be enforced via (OCL) constraints. For instance, one can create an association between
FSMDiagram
and
StartState
to indicate the start state. However, this information is not new and
can be inferred from the information currently available (we call this a
derived
association). Note
that one would still need a constraint to ensure the start state is contained in the FSM diagram!
Performance issues may influence such decisions (do we need to compute the start state often? If
so, such hard-coded association may be useful).
Containment relationships (aggregation or composition) can add precision to some associations
as well but are not really necessary in such a metamodel (unless it is used also as a file format,
where each class needs to be included directly or indirectly in a top-level class, like EMF
requires).
(b)
Several constraints will not be representable in your class diagram. Describe
2
of them
precisely in terms of the concepts/attributes/roles you defined, in
English
(no need to use
OCL
unless you really, really want to). Do not create constraints for what is already covered
by the class diagram, for example by multiplicities. (
6 marks
)
Constraints missing from the above diagram (again, these depend on your specific diagram):
-- A FSM diagram has exactly one start state
context FSMDiagram
inv
OneStartState:
self.states ->
select(s : State | s.oclIsKindOf(StartState))->size() = 1
Or, more simply…
context FSMDiagram
inv
OneStartState2:
self.states ->
Assignment #2
SEG3101 / Fall 2022
5/15
one(oclIsKindOf(StartState))
Informally: An FSM diagram has exactly one StartState among its states
-- Each state name is unique within the scope of a diagram
context FSMDiagram
inv
UniqueName:
self.states -> isUnique(name)
-- Each transition connects a pair of states that belong to the same
diagram
context Transition
inv StatesAndTransitionInDiagram0:
self.source.diagram = self.destination.diagram
Informally: the diagram of the source of a transition is the same as the
diagram of the destination of that transition
The above solution is a direct translation, but it is weak as the transition could belong to a
diagram different from the states it connects! The solution below ensures the transition and the
states it connects belong to the same diagram.
context Transition
inv
StatesAndTransitionInDiagram1:
self.source.diagram = self.fsmDiagram
and
self.destination.diagram = self.fsmDiagram
Informally: the diagram of the source of a transition and the diagram of the
destination of that transition are both the same as the fsmDiagram of that
transition.
Using a different context leads to much more complex expressions…
context FSMDiagram
inv
StatesAndTransitionInDiagram2:
self.transitions -> forAll(t: Transition |
( (self.states -> includes(t.source))
and
(self.states -> includes(t.destination)) ) )
-- A transition cannot have a start state as destination
context Transition
inv
NoStartStateAsDestination:
not(self.destination -> oclIsKindOf(StartState))
-- A transition cannot have an end state as source
context Transition
inv
NoEndStateAsSource:
not(self.source -> oclIsKindOf(EndState)
Assignment #2
SEG3101 / Fall 2022
6/15
-- No state can exist without at least one transition
context State
inv
NoStateWithoutTransition:
(self.toT -> notEmpty()) or (self.fromT -> notEmpty())
Informally: the toT transitons or the fromT transitions of a State is not
empty.
-- A super state can only have one input transition and one output
transition (could be interpreted as = 1...)
context SuperState
inv
SuperStateOneInOneOut:
(self.toT -> size() <= 1) and (self.fromT -> size() <= 1)
-- The FSM diagram referenced by a super state must have at least one
end state
context SuperState
inv
ReferencedDiagramWithOneEndState:
self.ref.states ->
exists( s : State | s->oclIsTypeOf( EndState ) )
Or, more simply…
context SuperState
inv ReferencedDiagramWithOneEndState2:
self.ref.states ->
exists( oclIsTypeOf( EndState ) )
Often,
oclIsTypeOf
() and
oclIsKindOf
() can be used interchangeably. The latter returns true if the
target object is of the specified type or one of its subtype (subclasses).
StartState
and
EndState
do not have any subclass here, so these two functions become equivalent.
-- A super state makes reference to *another* FSM diagram
context SuperState
inv
SuperStateReferenceAnotherDiagram:
not(self.diagram = self.ref)
In all cases, it is good practice to avoid redundancy (do not repeat in constraints what is already
in the class diagram, e.g., in multiplicities) and to properly name your invariants (so that one
knows what is violated).
Try testing your domain model (for yourselves) with likely FSM models. For example, this FSM
model should be supported as an instance of your domain model:
As shown in the object diagram below, this FSM model is indeed supported by our metamodel,
and the constraints are all satisfied. Note that object diagrams no longer have multiplicities (the
associations become binary links between two objects).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Assignment #2
SEG3101 / Fall 2022
7/15
As shown in the object diagram below, this FSM model is indeed supported by our metamodel,
and the constraints are all satisfied. Note that object diagrams no longer have multiplicities (the
associations become binary links between two objects).
B
A
E2
[x=y]
E1
[true]
H
(Sub)
FSM: Main
T5
T4
T2
T1
T3
T6
T7
K
E3
[x=0]
FSM: Sub
X1
X3
X2
Name
Start
[pre]
Start
[pre]
End
[post]
Super
(Ref)
Legend
S2
[x=3]
S2
[x=3]
S1
[y=1]
S1
[y=1]
Assignment #2
SEG3101 / Fall 2022
8/15
Q3. Goal modelling (25 marks)
In the following GRL model, tasks A to E can only take 0 or 100 as satisfaction values. The scale
of satisfaction values for the other elements is [0...100].
a)
What will be the level of satisfaction of the
Manager
actor for the following strategy:
<A, B, C, D> (i.e., A=100, B=100, C=100, D=100, with the other tasks being at 0 by
default)? (
2 marks
)
As explained in the Goal Modeling slides, the truncation in the satisfaction computation
Max(0, Min (100, ...)) ensures that the satisfaction of each item is truncated to the
interval [0..100] (as required in this question).
Increased performance = Max(0, Min(100, ( (-25*100) + (25*100) + (0 * 60) )/100)) = 0
Simplified tasks = Max(0, Min(100, ( (-25*100) + (60*100) + (25*100) )/100)) = 60
Pattern = Max(0, Min(100, (Increased Performance*50 + Simplified Tasks*50)/(50+50)))
= 30
Assignment #2
SEG3101 / Fall 2022
9/15
b)
What will be the level of satisfaction of the
Assistant
actor for the following strategy:
<B, C, D>? (
2
marks
)
Decreased Stress = Max(0, Min(100, ( (75*100) + (-50*100) + (-25 * 0)/100)) = 25
Assistant = Max(0, Min(100, (Stress decreased*100)/100)) = 25
c)
How many valid GRL strategies (where a valid strategy is a combination of tasks A to E,
as in the previous question, that satisfies the decomposition constraints) will allow the
System
actor to achieve a satisfaction level of 100? (
4
marks
)
For System to be 100, both Function 1 and Function 2 must be 100. For Function 1 to be
100, since we have an inclusive OR, we must select A, B or <A,B>. For Function 2 to be
100, since we have an AND/AND decomposition, Subgoal 1 and Subgoal 2 must both be
100. Subgoal 2 has an XOR decomposition, so D or E must be selected, but not both.
Subgoal 1 has an inclusive OR decomposition, so C or D or <C,D> must be selected. This
means that Function 2 is satisfied with <C,D>, <C,E> and D alone. By composing these
two sets of three selections, we get 9 strategies:
1: <A,D>
2: <A,C,E>
3: <A,C,D>
4: <A,B,C,D>
5: <A,B,C,E>
6: <A,B,D>
7: <B,C,D>
8: <B,C,E>
9: <B,D>
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Assignment #2
SEG3101 / Fall 2022
10/15
Here are the ratings for each of these strategies for all items:
d)
What are the valid strategies (as there could be more than one) that will maximize the
level of satisfaction of the
Manager
actor while ensuring that the System actor has a 100
satisfaction level? Please list these strategies (see format in the previous sub-questions)
and
indicate this maximum satisfaction value for the Manager actor. (
4
marks
)
Strategy 8 <B,C,E> maximizes Patron, with a satisfaction of 60. See the table.
e)
Similarly, what are the valid strategies that will maximize the level of satisfaction of the
Assistant
actor while ensuring that the System actor has a 100 satisfaction level? Please
list these strategies
and
indicate this maximum satisfaction value for the Assistant actor.
(
4
marks
)
Strategies 6 <A,B,D> and 9 <B,D> maximize Assistant, with a satisfaction of 75.
f)
Finally, what are the valid strategies that will maximize the level of satisfaction of the
entire
model
(using the relative importance weights of the actors) while ensuring that
the System actor has a 100 satisfaction level? Please list these strategies. (
4
marks
)
Strategy 9 <B,D> maximizes the whole model, with a satisfaction of 12.5*60/100 +
75*40/100 = 37.5
Assignment #2
SEG3101 / Fall 2022
11/15
Q4. Process modelling (25 marks)
a) Observe the following BPMN process models (Test1 and Test2). Which ones support each of the
following four execution traces? Your answers may be:
None
,
Test1
,
Test2
, or
Both
(
4 x 2 marks
)
•
Trace1 = < Fill form, Send form, Check total, Check name, Reject, Inform >
Both
•
Trace2 = < Fill form, Send form, Check name, Reject, Inform >
None of them. In both cases,
Check total
is also required (just before or just after Check name)
because
Check name
and
Check total
are in parallel (gateway +). In BPMN, gateway X is a choice.
•
Trace3 = < Fill form, Send form, Check name, Check total, Resubmit, Send form, Check total, Check
name, Reject, Inform >
Test 1. Test2 does not support the loop with
Resubmit
•
Trace4 = < Fill form, Send form, Check name, Check total, Accept, Reject, Inform >
None. In both cases,
Accept
is mutually exclusive with
Reject
in the choice
b) What is the number of complete execution traces possible for the Test2 model? (
3 marks
)
4, and these are:
< Fill form, Send form, Check total, Check name, Accept, Inform >
< Fill form, Send form, Check name, Check total, Accept, Inform >
< Fill form, Send form, Check total, Check name, Reject, Inform >
Assignment #2
SEG3101 / Fall 2022
12/15
< Fill form, Send form, Check name, Check total, Reject, Inform >
c) What is the number of complete execution traces possible for the Test1 model, if we limit the
number of allowed iterations to a maximum of 3? (
4 marks
)
2x2 (pas d’itération) + 2x2x2 (une itération) + 2x2x2x2 (deux itérations)
+ 2x2x2x2x2 (trois
itérations) =
60
d) What are the two major problems in the following UCM process model? (An informal
description of the process is not provided here as the problems are not at that level) (
2 x 3
marks
)
1) The first OR-fork has incomplete conditions (what to do when cost = 100?): dead end.
2) The path [cost<100], [!enoughTime], [cost>120] is infeasible. Postponed is not reachable.
These are similar problems to those we can often see in programming.
e) What is the major problem in the following UCM process model? (An informal description of
the process is not provided here as the problem is not at that level) (
4 marks
)
The [!OK] path will be blocked at the AND junction, because it needs to go through Retry to
synchronize, but Retry cannot be executed without prior synchronization. This is a typical
concurrency problem in process models.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Assignment #2
SEG3101 / Fall 2022
13/15
Q5. SPL and Feature Models
(25 marks)
Use the following feature model diagram with three constraints. Remember that the OR
decomposition used here is an
inclusive
OR where at least one child feature is required.
a) Are these
configurations
valid
and, if
not
,
why
? (
5 x 2 marks
)
•
Config1 = {ATM, Money slot, Card reader, Shielding window, Wall installation}
No. Protection is missing
•
Config2 = {ATM, Money slot, Card reader, Protection, Shielding window, Wall installation,
Authentication, PIN check, Biometric check, Iris, Fingerprint, Voice}
No. Fingerprint must be excluded (C1).
•
Config3 = {ATM, Money slot, Card reader, Protection, Shielding window, Wall installation,
Authentication, PIN check, Biometric check, Voice, Printer, Laser}
Yes
•
Config4 = {ATM, Money slot, Card reader, Protection, Shielding window, Wall installation,
Authentication, PIN check, Biometric check, Iris, Printer, Ink}
No, Ink must be excluded (C2)
•
Config5 = {ATM, Money slot, Card reader, Protection, Shielding window, Printer, Ink}
No, Wall installation must be included
b) A
dead feature
is a feature that is not part of any valid configuration. Are there any
dead
features
in this model and, if so, what are they? (
3 marks
)
Fingerprint (via C1), Ink (via C2), in red in the model (which could be simplified).
c) A
core feature
is defined as a feature that belongs to all valid configurations. In addition to
the root feature (ATM), what are the other
core features
of this model? (
3 marks
)
Money slot, Card reader, Shielding window (via C3), Protection (via Shielding Window), Wall
installation (via Protection), those are marked green in the model
d) What is the number of valid configurations for this model? Briefly explain why. (
4 marks
)
-
Authentication is optional but must have Biometric check, which has 3 itself options (Iris,
Voice, Iris+Voice) if selected. Fingerprint is a dead feature. So there are 4 options for this
branch: unselected, or one of the 3 Biometric check options.
- Printer is optional, but if this option is selected, then Laser must be selected (Ink is a dead
feature. So there are 2 options here: unselected, or Printer+Laser.
Assignment #2
SEG3101 / Fall 2022
14/15
-
So there are 4*2 = 8 valid configurations:
o
C1={ATM, Money slot, Card reader, Protection, Shielding window, Wall installation}
o
C2={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Iris}
o
C3={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Voice}
o
C4={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Iris, Voice}
o
C5={ATM, Money slot, Card reader, Protection, Shielding window, Wall installation, Printer, Laser}
o
C6={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Iris, Printer, Laser }
o
C7={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Voice, Printer, Laser }
o
C8={ATM,
Money
slot,
Card
reader,
Protection,
Shielding
window,
Wall
installation,
Authentication, PIN check, Biometric check, Iris, Voice, Printer, Laser }
e) If we combine the original feature model with the following goal model (which handles some
non-functional requirements), what are the valid configurations that will maximize the
satisfaction of the Bank? (
5 marks
)
- Don't forget that Fingerprint and Ink are dead features (cannot be selected) and that Shielding
window and Wall installation
- C4={ATM, Money slot, Card reader, Protection, Shielding window, Wall installation,
Authentication, PIN check, Biometric check, Iris, Voice}is the best configuration, with a
satisfaction of 70 per Bank
- C1
→
35, C2
→
60, C3
→
63, C4
→
70, C5
→
35, C6
→
52, C7
→
63, C8
→
63
Assignment #2
SEG3101 / Fall 2022
15/15
Description of group and roles
Provide a list of group members and their contributions for this deliverable. If for some
legitimate reasons the work distribution is unbalanced, please state these reasons in a short
paragraph. Note that the information provided here might be used to adjust the assignment
grade for the group members. Start early and do not let your group partners down at the last
minute!
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Recommended textbooks for you

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning


Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning

Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage LearningFundamentals of Information SystemsComputer ScienceISBN:9781305082168Author:Ralph Stair, George ReynoldsPublisher:Cengage Learning

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning


Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning

Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning