1

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

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

8 Comments

So in the Object Diagram I can leave out Controller and Sensor class definitions and leave the 3 objects and it will be fine as long as I provide the Class Diagram?
The "type" of the diagram is almost irrelevant. You can legally put anything in almost any diagram (with few exceptions) as long as it conveys what you try to express.
So how is something like this marked as coursework, if there are no concrete rules?
Not really. The UML spec states explicitly that you can mix anything into any diagram type (almost, there are a few exceptions).
See my addition in the answer.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.