Specification sequence diagrams show only one specific thread from the mind of the designer. Therefore, certain instances and messages will be missing. However, execution (animated) sequence diagrams reflect the full collaboration between objects. This is why the simple comparison between specification and execution sequence diagrams always fails. IBM® Rational® Rhapsody® provides various options that enable you to compensate for some of the necessary differences between the two kinds of diagrams when doing a sequence comparison.
Select Options in the Sequence Diagrams Comparison window to open the Sequence Diagram Comparison options window.
Use the following fields on the General tab to specify whether to use synchronization and to save or upload your option settings:
Sometimes the order of arriving messages is insignificant. The Synchronization option enables you to ignore the arrival times of messages and consider only the order in which they are sent.
In the resulting comparison display, equivalent messages are vertically synchronized in the adjacent window panes. This helps you to locate corresponding messages in both diagrams.
To enable or disable the synchronization option, select or clear the Synchronization box in the General tab.
You can save your options settings to a file and then reload them for subsequent message comparisons.
To save the settings:
<SD2>_<SD1>.sdo
The file extension .sdo stands for Sequence Diagram Options. If wanted, edit the path and default name for the options file.
To reload your option settings:
The sequence comparison options are restored to the settings last saved in the file.
The Message Selection tab, shown in the following figure, enables you to select which messages to include and whether to include arguments in the comparison.

On this Message Selection tab, the word "Ignore" is the default setting for the Arguments column for all messages. This means that, by default, argument comparison is ignored for messages.
Using this tab, you can:
Specification sequence diagrams typically include information that is essential to a particular use case or scenario. In many cases, they exclude the initialization phase messages, whereas execution sequence diagrams include all messages. Therefore, it might be necessary ignore certain messages when doing a comparison, such as constructors. Ignored messages are inaccessible in the resulting comparison window.
To exclude a message from the comparison:

There are two options for determining whether messages are identical: the first is to compare the message names and all arguments, the second is to compare only the message names. The latter option is more useful because sequence diagrams show four different kinds of arguments:
In specification sequence diagrams, you might not always provide complete information about message arguments. Because execution sequence diagrams record what the system actually does, they always show both argument values and names. Therefore, the message comparison ideally does not use arguments but rather focus primarily on message names.
When two messages are named identically, you can compare their arguments.
For example, consider messages called evDigitDialed(Digit). They would be equivalent if you compared only their argument names (Digit). However, if you compared their values (EvDigitDialed(Digit=0), EvDigitDialed(Digit=1), and so on), their argument values would not be equivalent.
Argument comparison occurs in the following steps:
To specify whether to use argument names or values:
These are commonly used settings:
| Specification sequence diagram | Execution sequence diagram | Value |
|---|---|---|
| Message() | Message(Arg = 1) | Ignore Arguments |
| Message(Arg) | Message(Arg = 1) | Compare Names Only |
| Message(1) | Message(Arg = 1) | Compare Names and Values |
In specification sequence diagrams, all messages sent by the environment come from specific objects. In execution sequence diagrams, however, these messages could potentially come from you interacting with the animation. This difference can impair the comparison.
In general, requiring a complete object match between execution and specification sequence diagrams is too rigorous a requirement. The solution is to associate objects in one sequence diagram with other objects in the other sequence diagram. Messages can then match if their source and target objects are associated in both sequence diagrams.
To associate objects with each other you create object groups. Object groups are, in essence, instance abstractions that bridge the gap between high-level use cases and actual implementation, or between black-box and white-box scenarios. Using object groups, you can then compare objects that do not have the same name, or compare one object to several other objects.
To view object groups, select the Instance Groups tab in the Sequence Diagram Comparison options window. The Instance Groups tab, shown in the following figure, displays a list of the existing object groups in the model. There is one object group for each object, which is, by default, the only member of its own group.
.
The objects that belong to the group are displayed in the Objects groups list at the bottom of the window. This means that the objects listed for SD1 are considered logically the same as those listed for SD2.
The Instance Groups tab enables you to perform the following operations:
To create an instance group:
To delete an existing object group:
Any objects that belonged to the deleted group are now unused and available to be assigned to another object group.
To delete all instance groups:
All objects are now unused and available to be assigned to a new object group.
If you want to associate different objects than the ones shown, either move one or more of the objects to a different object group or create a group. In either case, you first need to remove the object you are moving from the group it is currently in, because an object can only belong to one group at a time.
To remove an object from a group:
To add an object to the group:
To set all object groups back to the default of one group per object, click Set to Default on the Instance Groups tab. An object group is added for each object with the same object in SD1 and SD2 belonging to the group.
In specification sequence diagrams, you often must assume how the message queue works to determine the sequence of messages. It is highly likely that in specification sequence diagrams the order of messages will be different from the actual one specified in the statechart. An incorrect ordering assumption can result in large mismatch.
To avoid this problem, the comparison must be able to ignore the timing of messages. For example, a message M1 sent by an instance A1 after a message M2 sent by an instance A2 could match the same message sent before M2:

There can also be cases where two or more messages are to be sent at the same time, but the order is not important. Message groups enable you to specify groups of messages for which ordering is not important. There is a match if any message in the group occurs in any order.
The Message Groups tab, shown in the following example, enables you to create, modify, and delete message groups.
