Interaction Modeling Challenges
I was given an interesting challenge in our UML Operator Channel, from the Telling A Story Deep Dive video. In their modeling, they try to identify structure through behavior. They've identified several use cases and each use case has a communication diagram (e.g., they get some kind of a set of communication diagrams with already selected entities and messages between them). At the next stage, they try to identify the conceptual structure through a class diagram or a custom diagram.
They then throw on the diagram the already created classes that were created in the process of building communication diagrams and try to use the Sparx EA insert "Related Elements" and as a result get an Association relationship model. However, they would like to see all the messages that appear in the various communication diagrams associated with this Association.
The Problem
One word may be "Conflict". Unless they have separate "associations" between elements, each with their own message (association between 2 GUIDs or Global Unique ID's). With the "association" also having its own GUID, the messages may conflict to a point where the first message shows and the other(s) do not.
Let us set up this scenario how I may understand it. NOTE: We are using Sparx Enterprise Architect (EA) and we assume you are familiar with this UML Modeling Platform/Tool.
I first need to understand when you say "messages", you are referring to "message events" used in Communication Diagram types and not Sequence Diagram types.
I will assume...
- Class Diagrams and other Diagrams have been created.
- Create a New Diagram and copy/insert one system element to start.
- Select the starting Element in the new Diagram.
- From Design Tab and Element Group, select Add Element and "Related Element" should be enabled.
- From "Related Element", set Level to all 5; select "All" elements, and accept all default settings in Dialog.
- Elements inserted into New Diagram but do not have Communication Messages. The reason for this is by design and to not corrupt the sequence of messages (conflicts: 1, 1.1, 1.2, etc.).
There is a Trick (one Work Around)
PREFACE: To me, this has been a bug.
- Baseline Package(s) FIRST!
- We assume the "New Diagram(s)" are included that do not have Communication Messages showing in them.
- Register, in RAS, the entire project.
- Create a new empty Sparx Project for this Test Demo.
- Log into RAS and Import the package just registered
- Now the "Presentation" package with the combined elements shows the Communication Messages. However, if you check them, some are wrong sequence numbers.
- To make matters worse, if you select a message, right click and choose "Sequence Communication Messages...", this output doesn't match what is in the Presentation Diagram.
- And to further make matters worse, if you select "OK" in this Communication Messages dialog, it updates the Presentation Diagram with what it "thinks", which is still wrong.
Registering in Sparx Reusable Asset Service (RAS) copies ALL the Sparx Data for the package(s) and elements. When creating a new (separate) project and importing from RAS, we get "all the Sparx Data" and Sparx doesn't seem to apply the same rules. Thus, when importing the entire packages, all diagrams with their Element GUIDs and Connector GUIDs pick up the "message" data from the Communication Diagrams that were created. In diagrams where you DO NOT want these messages with the Associations, you have to individually Hide Connector, which removes the Message. Is this a BREAK or BUG?
This issue (bug) only happens when using RAS Import. If you Export using XMI (XML Metadata Interchange) and then Import that XML, you do not get the Messages from the Communication Diagram.
Fix the BREAK
- From Steps 7 & 8 above, we will fix/set the Communication sequences.
- Set/Fix the sequence of Groups and Events and hit OK.
- Do this will update the Communication Diagram impacted by these connections.
Conclusion
Both Communication and Sequence Diagrams are known as "Interaction" Diagrams. However, they differ.
- Focus: Sequence diagrams emphasize time-based interactions, while Communication diagrams focus more on structural relationships and collaborations.
- Representation: Sequence diagrams depict messages exchanged over time using lifelines and messages, whereas Communication diagrams use association relationships to show interactions without emphasizing the specific message sequence.
- Usage: Sequence diagrams are suitable for detailed scenarios where the chronological order of messages matters, while Communication diagrams are useful for presenting high-level structural relationships and collaborations among objects.
Sparx works the way it does...ON PURPOSE and according to standards. Sparx tries to not "break" your "stories", "architecture", or "models". However, Sparx is flexible with a little effort and allows you to do amazing things in telling your story...At least at the time of this Article (Build 1628).
I will produce a video demonstrating this subject soon. To keep up with Model-Driven Anything, subscribe to UML Operator Channel, and turn on Notifications to keep up.
Comments
Post a Comment