Reputation: 63
Fairly basic question but I can't find any guidance on it, we are using a shared repository and E.A. 14
When people add elements to diagrams - say dragging a class on to a Sequence diagram it creates a diagram element (if that is the correct terminology) in the same package as the diagram. with several diagrams in a package there can be a lot of elements, some appear to be duplicates because dragging a class on to many diagrams creates a new element each time for each diagram and it is all starting to get a bit messy.
Upvotes: 1
Views: 614
Reputation: 36333
EA has different ways to "create" diagram elements. When you ctrl-drag an element from the browser onto a diagram you are offered a dialog
Link
will just use the element as it is. It just references the dragged element. Usually that's what you want. An element can only be linked once. There is some crude Sparxian way to create shadow links, but I would not recommend using it.Instance
(which is what you apparently are using) creates an instance of the dragged element. Indeed it's an object which is classified by the dragged element. You can create as many objects as you like. But of course: they are all different and only have the classifier in common.Child
will finally also create a new element, but this time it's a clone of the dragged one which automatically gets a Generalization relation attached.You can save the selection so a drag will always use Link/... until you again Ctrl-drag again.
As a side note: when using sequence diagrams EA (Sparxian thinking) also allows the same thing. However, SDs shall not use links (namely Classes) but only Objects. When saving/re-loading via EA's version control you will just loose elements. A known bug - since decades. Will not be fixed since somewhere (good luck finding it) it's documented in the help.
As to your original questions: whether or not to use instances depends on what you want to show.
In no case you should re-use life lines in SDs. They represent different objects in different contexts. Make sure to put SD's in a context which is created for the purpose. Use Add/Interaction/with SD
from the context menu of a class in the browser to create such a logical brace.
Upvotes: 1
Reputation: 33
To avoid duplicate of the same class, it could be easier in your case, to first create the classes in a package and then use these elements to place them in different diagrams. But maybe you mean that you don't want to create objects out of classes in sequence diagram?!
Upvotes: 0