nus-cs2113-AY1920S2 / forum

4 stars 0 forks source link

Wrong arrow in the UML video (week 9) #76

Open Bencotti opened 4 years ago

Bencotti commented 4 years ago

Should the arrow for action factory to history be the other way around? Because point two states we add them to history object...

damithc commented 4 years ago

Anyone agrees (or disagrees)?

MeLoveCarbs commented 4 years ago

With regards to this arrow, The instructions for ActionFactory is: creates ActionsX, ActionY objects and adds them to the History object. Since ActionFactory did not specify that History object is a member object within its class, the History object is transient within ActionFactory and the arrow should be a dotted arrow indicating ActionFactory depends on History as well as ActionX and ActionY.

terrytay commented 4 years ago

In the Object Diagram, I think that :History should be linked to :ActionX instead of :Task. This will then align with the Class Diagram. Correct me I'm wrong. I'm still learning :-p

damithc commented 4 years ago

Quoting another post (#75) on this topic, by @rdimaio to bring all the discussion into one thread:

I think the error may be in the diagram drawn for Q2(b) in the bottom left corner. It says "one ActionX object containing one Task object has been created and added to the History"; I think it means that :ActionX should be added to :History (in which case History should point to :ActionX instead of :Task) (supported by the fact that History adds Repeatable objects, which is an interface implemented by Action, but not by Task)

damithc commented 4 years ago

Should the arrow for action factory to history be the other way around? Because point two states we add them to history object...

This is a point worthy of examination @Bencotti I assumed ActionFactory is the one creating objects and adding them to the History object, which means the ActionFactory object needs to be able to access the History object to pass on the Action object. Hence, the navigability is as given in the CD.

With regards to this arrow, The instructions for ActionFactory is: creates ActionsX, ActionY objects and adds them to the History object. Since ActionFactory did not specify that History object is a member object within its class, the History object is transient within ActionFactory and the arrow should be a dotted arrow indicating ActionFactory depends on History as well as ActionX and ActionY.

This is good point @MeLoveCarbs It may be possible for the ActionFactory to pass Action objects to the History object without keeping a long-term reference to the History object (in which case it would have been a dependency) but that requires some additional mechanisms. The straight-forward thing to do is for the ActionFactory to keep a reference to the History object (i.e., an association).

In the Object Diagram, I think that :History should be linked to :ActionX instead of :Task. This will then align with the Class Diagram. Correct me I'm wrong. I'm still learning :-p

That's the mistake I did. Your answer is correct, but I'm afraid @rdimaio beat you to it (in #75). So, the T-shirt goes to @rdimaio

damithc commented 4 years ago

I've added an explanation of the error to the end of the video BTW.