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: Tuesday, 16.04.13 - Due date: Monday, 22.04.13, 11: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: Reverse Engineering Class Diagrams

6+2 points

Create a class diagram for the solution to Assignment 1: Object Oriented Programming. For your convenience you may find a skeleton of the solution here. We already started with the work. You find the result in the project A2T02_ReverseUniversity.astah in your SVN. Add the missing classes Address, CollectiveIdentity, CollectorUtil, FastGrowingNumberGenerator, NumberGenerator and Professor at the same level of detail.

Explain for each of the following graphical elements what they mean (one word or a short sentence):

  • -, +, #
  • underlined attribute or method name
  • italic method name
  • Words in «Guillemets» (= French quotation marks)
  • The different kinds of arrows:
    • Dashed with open head or with triangle head.
    • Continuous with triangle head, with open head, with diamond at the start.

Task 03: 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

Task 04: 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 05 (optional): Association Classes

[4+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.

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/2013/assignment_2.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024