nus-cs2103-AY2021S1 / forum

20 stars 2 forks source link

Regarding unnamed objects in an Object diagram #529

Closed tjwjoe closed 3 years ago

tjwjoe commented 3 years ago

image

In this question from a quiz, the code creates the new Member objects with the variable names adam, ben and charlie, yet the Object Diagram omits their names. Is this allowed? I thought that omission of the object names means that the object is actually lacking of a name. For example in TestObj A = new TestObj(new B()), the new object B would be an unnamed object. I feel like this might introduce ambiguity if omission of the variable names are allowed when they are named.

damithc commented 3 years ago

In this question from a quiz, the code creates the new Member objects with the variable names adam, ben and charlie, yet the Object Diagram omits their names. Is this allowed? I thought that omission of the object names means that the object is actually lacking of a name.

That's not a strict rule. In this case, it's clear which object is which (based on the name attribute). Not much value added by using object names.