nus-cs2103-AY2021S2 / forum

10 stars 0 forks source link

text book exercise example #353

Closed prerthan99 closed 3 years ago

prerthan99 commented 3 years ago

given the question below, are the 2 diagrams correct and equivalent? If so, how can we show visibility (private, public, static) in the first option. and also, how do we show that the expected output type for open is void? Is it open() = void ?

Question: Screenshot 2021-04-23 at 11 30 51 AM

Ans: Screenshot 2021-04-23 at 11 35 08 AM

tlylt commented 3 years ago

Thanks for sharing!

edit: see https://github.com/nus-cs2103-AY2021S2/forum/issues/352#issue-865050502, there is a video in week 8 or 9 that goes through the design process for this exact question

damithc commented 3 years ago

To add, it's not possible to show visibility for associations shown as lines (within the scope of notations we cover in the module). Visibility is not that important anyway (compared to showing relationships between classes). Option 1 is still more useful than option 2 as a visual model of the design even if it doesn't show visibility.

prerthan99 commented 3 years ago

i was wondering if the arrow linking Box and lid should be bidirectional eg: lid 0..1 <------------------------> box 0..1? thank you

tlylt commented 3 years ago

@prerthan99 image

prerthan99 commented 3 years ago

ah ok. thank you.