程序代写案例-INFR10064

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
UNIVERSITY OF EDINBURGH
COLLEGE OF SCIENCE AND ENGINEERING
SCHOOL OF INFORMATICS
INFR10064 SOFTWARE DESIGN AND MODELLING
Monday 19 th December
2016
14:30 to 16:30
INSTRUCTIONS TO CANDIDATES
Answer QUESTION 1 and ONE other question.
Question 1 is COMPULSORY.
All questions carry equal weight.
CALCULATORS MAY NOT BE USED IN THIS EXAMINATION
Year 3 Courses
Convener: C. Stirling
External Examiners: A. Cohn, A. Donaldson, S. Kalvala
THIS EXAMINATION WILL BE MARKED ANONYMOUSLY
1. THIS QUESTION IS COMPULSORY
(a) In software engineering, what is design by contract? [2 marks ]
(b) How can design by contract reduce the cost of software maintenance? [2 marks ]
(c) What language was specifically designed for expressing contracts in the con-
text of UML models? [1 mark ]
(d) Draw a fragment of UML to show that a class named A specialises a class
named B. [2 marks ]
(e) Recall that LSP is one of the SOLID design principles. What does LSP
stand for? Briefly explain the aim of the principle. [3 marks ]
(f) Consider the following two Java classes. Do they obey the LSP? Explain
carefully why, or why not.
public class A {
public boolean doSomething (boolean b) {
return (not b);
}
}
public class B extends A {
public boolean doSomethingElse (boolean b) {
return b;
}
}
[3 marks ]
(g) Write in xtext three rules, Winner, Individual, Syndicate. They should
specify that: a Winner is either an Individual or a Syndicate; an Individual
is specified by the keyword individual followed by an ID; a Syndicate
is specified by the keyword syndicate followed by an ID, then a list of
Individuals contained within curly brackets {...}. In each case the ID should
be assigned to variable name; the list of Individuals should be called members.
Full marks can be obtained by solutions that include some minor syntactic
errors. [4 marks ]
(h) What are the two modes in which a QVT-R transformation can be executed?
Give the name of each and briefly explain the purpose of each. [4 marks ]
(i) What does it mean to say that a bidirectional transformation between model
spaces M and N is bijective? Briefly explain why a bidirectional transfor-
mation language should not enforce that all bidirectional transformations
are bijective. [4 marks ]
Page 1 of 3
2. ANSWER EITHER THIS QUESTION OR QUESTION 3
(a) List the three ways Martin Fowler says UML can be used (“UML as....”).
Explain the ways in one sentence each. [6 marks ]
(b) Imagine that after you have left university, you receive the following email
from a friend asking your advice.
Hi,
Hope all’s well with you. You paid more attention than I did to
software engineering at uni: can I ask your advice? I’m working
in software development for a startup company. It’s going well
and we have a stable team of good programmers... but I think
we need better design, because our stuff’s getting more and more
complicated every time we add a feature. A big problem is that
we have versions for six different operating systems and they’re
all separately maintained at the moment! We plan to start using
UML, but we’re not sure how (nobody here has ever used it before).
Should we use a modelling tool, for example? There’s no budget
for it so it would have to be an open source tool e.g. Papyrus. Or
are we better off without a tool? Any other suggestions for us?
Write a reply, giving your opinion and justifying it in terms of what you
have learned in this course. Carefully take into account all the information
in the email, and give points against as well as in favour of your suggestions,
but do be clear what you advise. [14 marks ]
(c) In a follow-up email, your friend describes this specific problem:
Our software has to deal with contracts, which consist of clauses,
and (for reason I won’t go into) we model each clause as an object.
It turns out that some contracts actually have things our client
calls pseudo-clauses which are effectively contracts themselves. We
tried having a class pseudo-clause and just duplicating some of the
behaviour of the contract class in it, but now it turns out that’s
not enough – we really might have a contract that contains a con-
tract, which might contain a contract, and so on, with no limit the
customer can give us on how many layers there might be! Help?
Name a common design pattern that is relevant to this situation. Draw a
UML class diagram, with classes named according to the terminology your
friend’s email uses. Explain in words what the diagram shows and how it is
relevant to the situation. [5 marks ]
Page 2 of 3
3. ANSWER EITHER THIS QUESTION OR QUESTION 2
(a) Sketch the OMG four-level metamodel hierarchy. [4 marks ]
(b) What is a domain specific modelling language? At which level of the OMG
4-level metamodel hierarchy does it fit? [3 marks ]
(c) In principle, what three things have to be defined, in order to define a
DSML? [3 marks ]
(d) Consider the following scenario:
Company A’s business involves selling highly customisable furni-
ture. For example, they sell bookcases in many sizes, made out of
different kinds of wood, with different styles, etc.
Currently, their sales staff, who visit the customers, communicate
by sending a plain text email to the warehouse staff. They then
have to use the information in the email to do several different
tasks. For example, they have to book installation staff time and
order materials, and what they have to book and order depends
on exactly what the customer wants. There is a complicated set of
rules that determines what they have to do, but the process is quite
routine; it doesn’t require intelligence.
Company A finds that the sales staff often miss out needed in-
formation, and the warehouse staff sometimes fails to follow the
complicated rules, so that time is wasted and problems arise. They
wonder whether they could provide a graphical tool which could
produce a model of the customer’s needs in a form that would be
easy for the customer to read, and from which they could generate
the inputs to the various systems automatically.
i. Briefly explain how, in principle, Company A could use a DSML in this
context. Mention specific technologies that could help them produce
the graphical tool mentioned, briefly explaining the role of each. [4 marks ]
ii. What other approach involving a domain specific language could Com-
pany A take? Give one pro and one con of this approach, as compared
with their plan for a graphical tool. [3 marks ]
iii. Briefly describe one way Company A could tackle its problems without
developing any domain specific language, and give one pro and one con
of this approach. [3 marks ]
iv. Draw a UML activity diagram to describe Company A’s process. Show
the distinction between what is done by the sales staff and by the ware-
house staff, and do not specify which of booking staff time and ordering
materials happens first. [5 marks ]
Page 3 of 3

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468