手写代写-INFR10064
时间:2021-11-15
UNIVERSITY OF EDINBURGH
COLLEGE OF SCIENCE AND ENGINEERING
SCHOOL OF INFORMATICS
INFR10064 SOFTWARE DESIGN AND MODELLING
Friday 13 th December 2019
09:30 to 11:30
INSTRUCTIONS TO CANDIDATES
Answer QUESTION 1 and ONE other question.
Question 1 is COMPULSORY. If both QUESTION 2 and
QUESTION 3 are answered, only QUESTION 2 will be marked.
All questions carry equal weight.
CALCULATORS MAY NOT BE USED IN THIS EXAMINATION
Year 3 Courses
Convener: S.Ramamoorthy
External Examiners: S.Rogers, S.Kalvala, H.Vandierendonck
THIS EXAMINATION WILL BE MARKED ANONYMOUSLY
1. THIS QUESTION IS COMPULSORY
(a) In software engineering, what is a design pattern? [3 marks ]
(b) List three advantages of learning design patterns. [3 marks ]
(c) Name two design patterns which involve trees, of arbitrary depth, of linked
objects. [2 marks ]
(d) What is the difference between a protocol state diagram and a behavioural
state diagram? Identify the kind of information that you expect to see in
one but not the other, and briefly explain how each kind of state diagram
is adapted to the needs of different readers. [4 marks ]
(e) Consider a class Signal, whose objects represent signals which can be on
or off; if a signal is on, it is either Red or Green. Operations on(), off(),
changeColour() change the state of a signal in the obvious way. If the signal
is off, changeColour() must be ignored. When a signal receives on(), its
colour must be whatever it was last time the signal was on, or Red if it has
never been on before. A newly created signal is off. Draw a UML state
diagram for Signal. [4 marks ]
(f) What does MOF stand for? [1 mark ]
(g) What is abstract syntax of a modelling language and what is concrete syn-
tax? Which can be defined using MOF? [3 marks ]
(h) A company with no history of modelling is considering whether to adopt
UML, or to develop a domain-specific modelling language for its specific
needs. Give two likely advantages, and two likely disadvantages, of choosing
UML. [4 marks ]
(i) The following xtext rule is supposed to say that a Song is specified by the
keyword song followed by an ID, which should be assigned to variable opus.
However, it contains a minor bug. State how to fix it.
Song:
’song’ opus::ID;
[1 mark ]
Page 1 of 3
2. ANSWER EITHER THIS QUESTION OR QUESTION 3
(a) What is Command-Query Separation? Explain briefly with the help of an
example. [2 marks ]
(b) What is a fluent interface? Explain briefly with the help of an example. [2 marks ]
(c) Your friend writes you a message which says “Hey, I’m confused. I thought
Command-Query Separation and fluent interfaces were both supposed to be
good ways to design an API. But they conflict, don’t they? You can’t follow
both in the same API anyway. So is one better than the other? Why did
we learn about both in SDM?”
i. Explain, using an example, what your friend probably means by “they
conflict”. [2 marks ]
ii. Write a helpful reply in not more than about 200 words. [10 marks ]
(d) The Tell, Don’t Ask design principle, which we did not study in this course,
can be expressed as follows: “Endeavour to tell objects what you want them
to do; do not first ask them questions about their state, then make a decision,
and finally tell them what to do”.
i. What are the advantages of following this advice? Be specific about
what is being improved. [4 marks ]
ii. Briefly discuss the relationship between this principle and the other
design advice you met in the course (including, but not limited to, the
advice to use CQS and write fluent interfaces). Comment on ways in
which it is redundant (follows from other advice), compatible (could
be followed alongside other advice) or incompatible (contradicts other
advice).
Aim to write not more than 100 words; note form is fine. [5 marks ]
Page 2 of 3
3. ANSWER EITHER THIS QUESTION OR QUESTION 2
(a) What does OCL stand for and what is OCL? Briefly, with the help of an
example, explain how you might use it in the definition of a MOF-based
domain-specific modelling language. [4 marks ]
(b) Explain carefully in English what the following OCL expressions mean.
Mention what you are assuming about the context in which each occurs.
i. x = x@pre + 2 [2 marks ]
ii. self.w -> select(p -> nonEmpty()) -> nonEmpty() [3 marks ]
iii. self.w -> forall(q -> nonEmpty()) [2 marks ]
(c) It is 2030 and you are in charge of software engineering at a small, but rapidly
growing, company which develops student record systems for universities.
You receive the following email from a colleague.
Hey!
A month ago I went to a seminar on a new bidirectional trans-
formation language called XBX, and I’ve been playing with it ever
since. It’s fantastic - fixes all the problems of QVT-R and TGGs. I
think we should adopt it: it’s going to make modelling much better
value for us. Happy to tell you more about it...
Write a note in response, in terms that will make sense not only to this
colleague but also to other colleagues who do not know about bidirectional
transformations. You may make any assumptions you wish about the nature
of the company, but do state what you assume. Include:
• a brief summary of what a bidirectional transformation language is, and
why your company has not been using one so far;
• an explanation of how a really good bidirectional transformation lan-
guage might “make modelling much better value” for you;
• an initial list of things you will want to find out about XBX, in order
to decide whether to investigate it further. [14 marks ]
Page 3 of 3





































































































学霸联盟


essay、essay代写