Search code examples
umlenterprise-architect

Organising Diagram Elements in Enterprise Architect


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.

  • Is there a better way of organising things?
  • Is there a way of setting a default package for diagram elements separate from the package containing the diagrams?
  • Does it matter that one class can have many diagram elements representing it or should we be trying to reuse the existing diagram elements?

Solution

  • 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

    enter image description here

    • The 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.
    • The 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.