nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

[Practice Paper] UML diagram p3.07 #420

Closed BoAi01 closed 1 year ago

BoAi01 commented 1 year ago

I have two questions about the below question and answer:

  1. The constructor of the Client is activated, so the activation bar should connect to the c:Client box. Based on this, answers other than 2 and 3 should be wrong, but why is the last one correct?
  2. Where is it in our textbook that mentions the lifeline of an object created earlier should start from a higher point?
Screenshot 2023-04-25 at 3 45 50 PM Screenshot 2023-04-25 at 3 45 23 PM
hingen commented 1 year ago
  1. Activation bar is optional so it is not wrong to not provide it. Because s is created before c is created, we can eliminate 1, 2, and 3. Option 4 is incorrect because "c:Client" and "s:Server" are underlined. Hence, answer is the last option.

  2. Not sure if it was mentioned in our textbook but pretty sure it was brought up a few times in lectures and tutorials.

BoAi01 commented 1 year ago

Why are 2 and 3 wrong? They are the only ones that show the invocation of constructors.

hingen commented 1 year ago

Why are 2 and 3 wrong? They are the only ones that show the invocation of constructors.

sry, misread ur question initially. I've edited my response.

BoAi01 commented 1 year ago

Thanks for the explanation. But just to confirm, activation bars are optional? Could you point to somewhere in the textbook? Probably I missed it.

SPWwj commented 1 year ago

Thanks for the explanation. But just to confirm, activation bars are optional? Could you point to somewhere in the textbook? Probably I missed it.

Minimal Notation

hingen commented 1 year ago

^ Yup, Minimal Notation

image

BoAi01 commented 1 year ago

Great. Thank you all!