nus-cs2103-AY2021S2 / forum

10 stars 0 forks source link

Discussion of Past Year Paper #357

Open ZhangAnli opened 3 years ago

ZhangAnli commented 3 years ago

Hello! Here are my answers for this PYP. Please feel free to let me know what my mistakes are!

image

Screen Shot 2021-04-23 at 3 06 28 PM
tlylt commented 3 years ago

Thanks for sharing!

PS: Just my 2 cents :)

ong6 commented 3 years ago

To add to what @tlylt has mentioned,

I think it's possible for StockItem to have a composition to Review (since it seems unlikely that a review would exist without an item)

My attempt: image

tlylt commented 3 years ago

To add to what @tlylt has mentioned,

I think it's possible for StockItem to have a composition to Review (since it seems unlikely that a review would exist without an item)

My attempt: image

Btw your double arrow from Inventory to Item is wrong. If there is a stronger association indicated by the solid line, there is no need to include a dependency line anymore

kouyk commented 3 years ago

StockItem to Review, I used 0..1 instead as I feel that it might be possible if null is passed in

Even if null is passed in, a Review object will still be created, so it should be just 1.

ong6 commented 3 years ago

Btw your double arrow from Inventory to Item is wrong. If there is a stronger association indicated by the solid line, there is no need to include a dependency line anymore

Oops forgot to erase it

tlylt commented 3 years ago

StockItem to Review, I used 0..1 instead as I feel that it might be possible if null is passed in

Even if null is passed in, a Review object will still be created, so it should be just 1.

@kouyk True, I think in this case StockItem to Review has to be 1. I think for Review to Rating, it could still be 0..1?Unless it does not matter if it is null or not

ong6 commented 3 years ago

StockItem to Review, I used 0..1 instead as I feel that it might be possible if null is passed in

Even if null is passed in, a Review object will still be created, so it should be just 1.

@kouyk True, I think in this case StockItem to Review has to be 1. I think for Review to Rating, it could still be 0..1

Review to rating should also be 1, since the code indicates that there is a Rating inside review. I don't think null matters in this case. Maybe @damithc can clarify more?

tlylt commented 3 years ago

image If Review class is simply like above, we all agree that it could be 0..1, So either it means that if a variable is never explicitly initialized we can treat it as 0..1 or it means that if a variable could be assigned null, then we treat it as 0..1 That's my interpretation, will be good if prof clarifies

damithc commented 3 years ago

Review to rating should also be 1, since the code indicates that there is a Rating inside review. I don't think null matters in this case. Maybe @damithc can clarify more?

Wasn't this entire question discussed during tutorial 8? You may want to watch the week 8 tutorial recording. :-p

tlylt commented 3 years ago

Review to rating should also be 1, since the code indicates that there is a Rating inside review. I don't think null matters in this case. Maybe @damithc can clarify more?

Wasn't this entire question discussed during tutorial 8? You may want to watch the week 8 tutorial recording. :-p

Are tutorial recordings available for students to view? Doesn't seem to be able to find them.

damithc commented 3 years ago

Are tutorial recordings available for students to view? Doesn't seem to be able to find them.

In the MS Team for your tutorial group, there is a file called Recordings.docx that should contain all the tutorial recordings. If not found, ask the tutor to update it.

As the exam is tomorrow, here's the recording from my T8.

https://nus-sg.zoom.us/rec/share/Nk2-lh73_3zm5ij8kf5cipZwc1zpdWwrIVNz8L5Wki_I-Fq7MpV5P1KIjH4oqZ_H.h-TLRgoVjgwFsOSV

Access Passcode: cs2103-tutorial

ong6 commented 3 years ago

According to the tut, 0..1 is fine for variables (40:00 mins) prof mentions this.

image

prerthan99 commented 3 years ago

here's my attempt. ive fixed some of the 'bugs' but i think its pretty similar

Screenshot 2021-04-23 at 5 21 32 PM

prerthan99 commented 3 years ago

actually, I do think that from StockItem to Rating there should be 1 because it's in the constructor. Im not sure if we can pass in null instead of the enums in a constructor without causing an error. if it is possible to pass null then I guess 0..1 is valid but if we cant pass in null, id say it should be 1

prerthan99 commented 3 years ago

Are tutorial recordings available for students to view? Doesn't seem to be able to find them.

In the MS Team for your tutorial group, there is a file called Recordings.docx that should contain all the tutorial recordings. If not found, ask the tutor to update it.

As the exam is tomorrow, here's the recording from my T8.

https://nus-sg.zoom.us/rec/share/Nk2-lh73_3zm5ij8kf5cipZwc1zpdWwrIVNz8L5Wki_I-Fq7MpV5P1KIjH4oqZ_H.h-TLRgoVjgwFsOSV

Access Passcode: cs2103-tutorial

is the audio working or is it just my issue?

kouyk commented 3 years ago

actually, I do think that from StockItem to Rating there should be 1 because it's in the constructor.

Isn't StockItem to Rating a dependency? Where does the multiplicity come in?

Im not sure if we can pass in null instead of the enums in a constructor without causing an error.

Enums can be set to null, it is the responsibility of the relevant code to verify that it is not null to ensure correctness.

kouyk commented 3 years ago

is the audio working or is it just my issue?

It does appear that the issue is on your side, the audio works for me.