nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Query on object diagram's compliency with class diagram #995

Open Li-Zizhen opened 6 months ago

Li-Zizhen commented 6 months ago

image

Given this class diagram, does an empty object diagram(with not object) comply with this class diagram? Does the empty object diagram comply with every class diagram?

Given this class diagram, does an object diagram with an object of type not shown in the class diagram comply with this class diagram?

dillontkh commented 6 months ago

What does it mean for an object diagram to comply with a class diagram? My perspective is that it means the object diagram does not contain any details that would contradict the information provided in a given class diagram.

With that assumption, I think both examples you gave would comply with the given class diagram as nothing about them contradicts the restrictions in the class diagram.

damithc commented 6 months ago

What does it mean for an object diagram to comply with a class diagram? My perspective is that it means the object diagram does not contain any details that would contradict the information provided in a given class diagram.

Almost. In addition, given object diagrams represent object structures that can result while running the system, and the class diagram represents the class structure of the system, an object diagram should also not have anything that is not present in the class diagram.

Given this class diagram, does an object diagram with an object of type not shown in the class diagram comply with this class diagram?

So, this will not be considered as compliant.

dillontkh commented 6 months ago

object diagrams represent object structures that can result while running the system

I see, that's definitely an important distinction to make. Thanks for the clarification!

damithc commented 6 months ago

Does the empty object diagram comply with every class diagram?

Technically, yes.