Sequence Diagrams and Version Control
You might create Sequence diagrams that use elements from other Packages as the Lifelines within the diagram. In such cases, the diagrams could be corrupted when the element Packages are checked in and out under Version Control. This is because during checkout the elements are first deleted from the model and then re-imported, and although they are reinstated in the diagrams, any Messages connecting them are not.
So, if the diagram and its elements reside in different Packages, a round-trip of the element Package through Version Control might damage the Sequence diagram.
The solution is to drag-and-drop each Class onto the Sequence diagram as an object - when you drop the Class onto the Sequence diagram, in the 'Paste Element' dialog select the 'as Instance of Element (Object)' option. This creates a new object in the diagram's parent Package, based on the selected Class element. You then create the Messages between the objects.
Therefore, to ensure that a Sequence diagram is not damaged by round-trips of other Packages through Version Control, remember that:
- The Lifelines must be objects (even though you can drop elements as Lifelines onto a Sequence diagram, it is not a strictly UML compliant construct)
- The Lifelines must be in the same Package as the diagram
This illustration shows the Browser window with two Packages: P1, containing the elements, and P2, containing a Sequence diagram that uses those elements. The diagram itself is also shown.
This diagram is not damaged, because all the Lifelines are objects and these objects reside in the same Package as the Sequence diagram.
- These recommendations also apply to Communication diagrams