nus-cs2103-AY2324S1 / forum

10 stars 0 forks source link

Can multiplicity be a variable in class diagrams? (Practice exam part 2) #555

Closed matochichap closed 9 months ago

matochichap commented 9 months ago
image image

In the image above, the multiplicity for watchers is 0...10 because MAX is 10 from ProgressWatcher.

Is writing multiplicity as 0...ProgressWatcher.MAX allowed since it makes it clearer that the max number of watchers depends on that variable. Also the MAX variable is not defined as a final variable so that value can be changed and it would be misleading to state that the multiplicity is 0...10

Alternatively, is it better to replace the navigability with a field under the Activity class as shown in the image below? It would be able to capture more information too since it can indicate that the field is private as well.

image
damithc commented 9 months ago

Is writing multiplicity as 0...ProgressWatcher.MAX allowed since it makes it clearer that the max number of watchers depends on that variable. Also the MAX variable is not defined as a final variable so that value can be changed and it would be misleading to state that the multiplicity is 0...10

Yes, it is allowed @matochichap