umlclass-diagramobject-diagram

Class Diagram and Object Diagram


I am making a structural diagram in UML using classes and objects and wondered if I was doing it correctly.

Would the following (on the right) be the correct way to represent an object diagram of the left-hand side class diagram?

enter image description here


Solution

  • No. You are using a Generalization which is not the case. Either leave that out or use a stereotyped dependency <<instanceOf>>. Note that this is no standard as per UML specs. But those specs leave you the freedom to express is this way.

    The class from which the object is instantiated is already shown in the name objectName::className.

    From Annex A p. 683 of the UML 2.5 specs, which describes the organization of diagram types:

    NOTE. This taxonomy provides a logical organization for the various major kinds of diagrams. However, it does not preclude mixing different kinds of diagram types, as one might do when one combines structural and behavioral elements (e.g., showing a state machine nested inside an internal structure). Consequently, the boundaries between the various kinds of diagram types are not strictly enforced.