Object diagrams

 

Definition

Object diagrams present class instances with their links and the messages exchanged. 

 

Objects and links can be created without being linked to a class or an association. Messages are directly added to an existing link: if the link is oriented, the message is created with the same orientation; if not, it is created oriented towards the box nearest to the point where the user has clicked.  A synchronous message is represented near the link in the form of a complete arrow and its label.  An asynchronous message is represented near the link in the form of a empty half arrow and its label.  It is not possible to create or represent a message for an n-ary link.

 

Objects can be connected to existing classes, or created independently.  Connecting objects to classes allows you to connect links to associations and messages to operations.

 

Object diagrams (an example is shown below) are created in packages, classes, interfaces, components, artifacts, nodes, collaborations and instances.

 

An example of an object diagram

 

 

Creating instances

Instances are created in object diagrams by clicking on the  "Create an instance" icon in the diagram palette and then clicking in the diagram at the point where you want the new instance to appear.

 

To name the instance, simply type over the highlighted default name.  To define which class is instantiated by the new instance, carry out the steps shown below.

 

Creating an instance of the "Budgie" class

 

Steps:

·        Double-click on the instance in the diagram it to open the "Instance" dialog box, and select a class from the dropdown list available in the "Instantiate" field.

·        After confirmation, the instantiated class name appears after the name of the instance.

 

 

Creating attribute links

An attribute link is an occurrence of an attribute in an instance.  To create an attribute link, simply click on the  "Create an attribute link" icon in the diagram palette and then click in the instance for which you want to create the new attribute link.

 

To name the new attribute link, simply type over the highlighted default name.  If you want to define a base attribute (an attribute represented by the attribute link), simply double-click on the attribute link to open its dialog box and then select an attribute from the dropdown list available in the "Base attribute" field.

 

 

Creating links and n-ary links

A link is a tuple of object references that is an instance of an association or an association role.

 

To create a link, simply click on the  "Create a link" icon in the diagram palette and then click on the origin instance and then the destination instance.

 

To define the link, simply select it.  When selected, it appears in blue and the value entry boxes appear.  Select a value entry box, press F2 to activate it and then enter a value directly over the highlighted zone.

 

It is also possible to create an n-ary link, which is simply a link connecting more than two instances.  To create an n-ary link, simply click on the  "Create an n-ary link" icon in the diagram palette, then click on the first instance followed by the second and any subsequent instances.  N-ary links are defined in the same way as simple links.

 

Note:      Link values can also be entered or changed through the associated dialog box, opened by double-clicking on the link.

 

 

Migrating UML 1.4 object diagrams to UML 2 object diagrams

If your model contains object diagrams created using an earlier version of Objecteering, these UML 1.4 object diagrams are automatically migrated to UML 2 through the automatic creation of a UML 2 object diagram when the UML 1.4 object diagram is opened.  This UML 2 diagram has the same name as the earlier diagram, belongs to the same model element and is directly displayed.

 

The new diagram retains the following information from the migration of the earlier diagram:

 

Association labels are positioned using the new intelligent positioning system implemented in UML 2 diagrams.

 

Since the earlier UML 1.4 object diagram is conserved, it can still be opened after migration in the usual way (either by double-clicking on it in the Objecteering explorer, or through the "Edit" command in the context menu).  The diagram is then opened in read-only mode, meaning that only the zoom and grab functions are active.

 

We recommend that the UML 1.4 object diagram be deleted once it has been migrated.  If the new UML 2 object diagram is renamed, the migration procedure will once again be run the next time the UML 1.4 object diagram is opened.