SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Assignment 2: UML, Class and Object Diagrams

Release date: Wednesday, 11.04.12 - Due date: Monday, 16.04.12, 23:59

How to draw an Object Diagram? Create a Class Diagram with astah. In the middle of the tool bar you find the “InstanceSpecification” and directly next to it the “Link”. These are the ingredients of an Object Diagram. For an instance of an Association Class it is ok to place it just next to the corresponding link, as it seems to be impossible to connect it with the link. (Other solutions are welcome, but be ready to explain how it should be. If you don't use astah, but provide a PDF or PNG, this is OK this time as well.)

Task 01: Aggregation vs Composition

2 points

Give us four examples of a part-whole relationship, two examples of an aggregation and two examples of a composition relationship. Argue for each of the four cases why it is an aggregation or an composition respectively. (Such an argument would consist of the generic criterion for choosing the respective type of association and one or two sentences arguing why the criterion applies here.)

[Optional, 0 points]: Can you find an example where it depends on the context whether it is an aggregation or composition.

Task 02: Matching object and class diagrams

3 points

Consider the following object diagrams (on the left) and class diagrams (on the top). Check for each object diagram the class diagrams which could be an instance of it (for example in form of a list).

1 2 3 4
A
B
C
D
E
F
G

Task 03: Three approaches to model roles

2+2+2 points

The following three class diagrams model the relationship of a president with his country. The models are getting increasingly more complex, i.e. B is more complex than A and C is more complex than B. In general you should keep your models as simple as possible, so there have to be reasons for creating more complex diagrams.

A) President as a role in a association
B) President as specific subclass for the role player
C) President as separate class associated with the role player

Please do the following:

  • Create the class diagrams with astah and add multiplicities to all association ends. If you feel that it is not clear why you have chosen a multiplicity add a note arguing for it.
  • Compare the three class diagrams. Explain in in which sense one diagram is more complex than the other. Explain as well (e.g. by giving examples) why the additional complexity might be useful.
  • Choose one of the models and add for each of the classes at least one meaningful attribute. Then create an object diagram that conforms to the class diagram containing at least two presidents.

Task 04: Association Classes

4 points [+2 points]
Two ways to model employment
Two ways to model appointments

Give us for each of the four class diagrams above:

  • An object diagram that is compatible with the class diagram.
  • Provide for the fourth class diagram an object diagram that violates the third class diagram.

Optional: We claim that the two first diagrams are equivalent.

  • Describe the exact conditions under which using an association class is equivalent to having a class between the two associated classes.
  • Give a (semi-formal) proof of the equivalence.
teaching/lectures/oosc/2012/assignment_2.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024