nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Practice Paper UML diagram #416

Open seadragon2000341 opened 1 year ago

seadragon2000341 commented 1 year ago

Hi, for the Practice Paper UML diagram, why is activity dependent on Progress Watcher? Shouldn't it be dependent on Watcher instead since watch takes in Watcher as a parameter?

2) Also, why are some methods package private and some public?

3) "An activity can consist of sub-activities" -> why should we use composition here? If we use composition, dosen't it mean that an activity cannot exist without other activities? Thank you!

hingen commented 1 year ago

image

hingen commented 1 year ago
  1. In Java, if no access modifier is specified it is package-private by default (represented by ~). Special exception for interface where all methods will be public (+). watchers is the only private field but it is likely represented as an association so I don't believe a private access modifier (-) appears anywhere in the class diagram.

  2. Not sure. I guess it is possible to interpret it as composition (since "sub-activities" means part of a main activity). Think this might be up for interpretation. I went with "association" when I was doing the practice paper.

seadragon2000341 commented 1 year ago

Thanks for the help @hingen !

I was also wondering why for this question, the last option is not compliant? Also for the 4th option, why is it compliant since there is no mention of Activity referencing another activity? image

damithc commented 1 year ago

I was also wondering why for this question, the last option is not compliant? Also for the 4th option, why is it compliant since there is no mention of Activity referencing another activity? image

@seadragon2000341 As this is a separate question altogether, best to post it as a separate issue.

damithc commented 1 year ago

In fact, unless interlinked, best to raise each question as a separate issue so that each issue can be given an appropriate title and each question can be discussed independently.

damithc commented 1 year ago

3. "An activity can consist of sub-activities" -> why should we use composition here?

@seadragon2000341 Somewhat related https://github.com/nus-cs2103-AY2223S2/forum/issues/421#issuecomment-1521509530

In addition to the phrase consists of, the term sub-activity also suggests a whole-part relationship. For example, consider folders and sub-folders.

If we use composition, dosen't it mean that an activity cannot exist without other activities?

No. It means if X is a sub activity of Y, then X cannot exist without Y. But if Z is not a sub activity of any other activity, it can exist just fine.

But as you know, the existence of a composition is a somewhat subjective thing, and it is not 'incorrect' to leave it out (it makes the diagram slightly less informative, but still correct).