Link a StateDiagram to a ClassDiagram?

Hi all,

I’m an embedded C++ programmer using VP to rough some designs and document, not forward engineer.

I’ve created some simple State Diagrams for different components of my target and then created some Class diagrams that will implement them. I want someone performing maintenance to be able to look at the StateDiagram to understand the real world functionality and then be able to see a link to what the implementation is.

Does UML support some sort of loose linking mechanism? Does VP?

Any help, or pointers in a more appropriate direction are appreciated.



I’m not sure about what do you mean by saying “does UML support …”. UML standard states that state machines are used for modeling discret behaviour. And nothing about direct or indirect links between diagrams and diagrams elements. See “Unified Modeling Language: Superstructure, version 2.0”, Ch. 15. “State Machines”.

Linking a state machine diagram to a class is simple in VP. Just right-click on a class, and in “sub diagrams” menu choose a state machine diagram, an actvity diagram or any other kind of diagram you ever need. In your case you need not to create a new state machine diagram, but rather choose existing one instead.

But, as I understand, you whant to link a state machine diagram to a class, not class to a state machine diagram. As for me, I don’t know standard way to link a diagram to a model element (not an element to diagram) in VP.

Maybe it helps to link a diagram (state machine diagram) to a diagram (class diagram, where the class resides)? If so, just put Diagram Overview shape on a state machine diagram and link this shape (by using it’s “Sub Diagrams” menu) to one or more class diagram(s). It should allow users to navigate between the diagrams, but that link will not directly point to a class. Of course, it is possible to create a diagram with only one class on it, but it seems kinda stupid. However.

If the only thing you need is to give the ability to see the classifier name, you may define some kind of user-defined tags for a state (say, “classifier”) and link it directly to a class (see tagged values tab on a state specification dialog).

P.S. States in VP have no classifier (surprise!), but you may use tags and in some cases it helps - you may put more than one class states on one diagram to illustrate an influense, declare some comprehensive constrants, etc.