1

I have a diary app, which I can write diaries, edit, lock and delete them like any other app and also I can add a location to the diary.

I also have a calendar tap which I can see the days I wrote a diary on it, so if I wrote a diary on 15 march 2023 I will see a dot on this day and when I click on the day the diary will appear. I also have a map tap which I can see the diaries on the map depends on its location.

So if I have a class diagram, there will be 3 classes in this case, calendar, diary, map, I want to make a relationship between these classes.

So the question here: if I want to make a relation between the diary class and the calendar it will be aggregation right? which the diary is part of the calendar, and the diary is also part of the map so it is aggregation, right? So can I make 2 aggregation on the same class here?

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Well, see https://stackoverflow.com/questions/9640885/uml-aggregation-vs-association the 2nd answer. You probably mean composite aggregation, right? – qwerty_so Mar 16 '23 at 18:25

1 Answers1

0

General remark: The shared aggregation has according to the current UML specification no particular meaning defined, compared to a normal association. The advice is therefore to avoid it, to keep diagrams simple.

Some people still think/teach that shared aggregation corresponds to a whole-part relationship. This belief dates back to UML 1.4 but is no longer true since UML 2, for more than 20 years. If you nevertheless want to use shared aggregation, be reinsured that the same class can have several aggregations with other classes. The only constraint is that aggregation is only for binary associations, and only on one end of the same association.

Regarding your model: Let's first disambiguate the diary, which is a record of events, and with which ou probably mean the diary entry. The diary entry is not a part of the calendar: a diary entry is made for a specific date, and the date is part of the calendar. The diary is not either part of the map. The diary entry can be associated to a specific place, and the place belongs to a map (more precisely, it doesn't even belong to the map, but it is represented on a map):

enter image description here

Of course, this is only an example, leaving multiplicities unspecified.

Christophe
  • 68,716
  • 7
  • 72
  • 138