QUESTION 1:
a) Draw the UML class diagram of the system that has the given sequential interaction
diagram on the right. :A :C
b) What kind of visibilities exists af(int i):char
among these classes? create(int k, int m)
b: B
c) Re-design the classes A,B and cf(b)
C by taking the “low coupling”
pattern into account and draw the bf()
UML sequential diagram again.
QUESTION 2:
A class X, to fulfill its responsibility r(), gets service from (sends message m() to) class A.
There is a possibility, that in the future class A can be replaced by class B, which has a
different interface. Class A will be completely removed from the system and class B will be
used instead of it. It is not possible to use more than one class at the same time to get the
service.
a. Design this part of the system according to design principles and patterns. Draw the class
diagram and mention the principles and patterns used in this solution.
b. Is the polymorphism necessary for this solution? Explain shortly.
c. Assume that Class A will not be removed from the system and class X will get the same
service sometimes from class A and sometimes from B. In the future a new class C can
also be added to the system. Design this part of the system, draw the class diagram and
mention the principles and patterns used in this solution.
QUESTION 3:
The advice proposed by the creator pattern of GRASP is that “Assign class B the
responsibility to create an instance of class A if B has the initializing data that will be passed
to A when it is created”.
a) Show an exemplary case where this advice of the creator pattern contradicts to other
principles and patterns.
b) Show how the system should be designed in such a cease by drawing a UML
communication diagram.