The Sequence Diagram

Sequence diagrams are a good way to show method calls between your classes and the order in which they occur.

Creating a sequence diagram

  1. On the Diagrams menu, click New Sequence Diagram.

Messages

UML modeling defines a message as a communication between objects that can include classes, humans, and other systems. Because LumiCode is modeling your code, most of the "messages" on your diagrams will actually be method calls. A "message to an object" can usually be thought of as a "call to a method". The object is the class.

The exception to the "object is a class" rule is when you create a User Object. User Objects let you model things that don't exist in your code.

Adding a start method

A start method is the first method in a chain of calls you want to display.

  1. Add a start method by clicking on it in the Method Tree.

  2. The class the method belongs to will be added to the diagram also.

  3. When you add a start method, it will be selected and its calls will be shown in the Called Method List.

The Called Method List

The methods that are called from the currently selected method are displayed in the Called Method List in the lower left corner.

Selecting a method

To add calls from a method to the diagram, or to remove a method from the diagram, you need to select it.

  1. Click on the method name or the activation box to select a method.

  2. When a method is selected, its activation box will be grayed.

  3. When a method is selected, the calls from it (if there are any) will be shown in the Called Method List.

Adding called methods

  1. Add a single method call by clicking on the method name in the Called Method List.

  2. Add all the called methods by clicking the arrow button.

Showing system methods

Check the Show System checkbox to include methods belonging to classes from the System namespace in the method tree. This will let you put them on your diagram. Show System also affects selections made by the selection arrow. Leaving this unchecked can help keep your diagrams from becoming cluttered.

Showing properties

For each property there is a get method and/or a set method. Check the Show Properties checkbox to include get and set methods in the method tree so you can put them on your diagram. Show Properties also affects selections made by the selection arrow. Leaving this unchecked can help keep your diagrams from becoming cluttered.

Polymorphic calls and overrides

When your code makes a polymorphic call, the method that actually gets called is determined at run time. LumiCode lets you select which override of the virtual method to display on your diagram.

In the Called Method List, overrides to a virtual method are indented and listed under the method they override.

You can selected the base method, or any of the overrides for the base method. Only one override option can appear in a single call sequence, so selecting a new one will replace the old one.

Removing a method call

  1. Click on the method you want to remove to select it.

  2. Press the Delete key to remove the selected method from the diagram. Alternately, use Remove selected on the right click menu.

Adding a caption

  1. Position the mouse over your diagram, and then click the right mouse button. Select Add caption. Enter your text into the Caption Editor.

  2. Click Change Font if you wish to change the font, font size, or text color.

  3. Click OK. Items on the diagram will be moved down to make room for the caption.

Adding a comment

  1. Position the mouse over your diagram, and then click the right mouse button. Select Add comment. Enter your text into the Comment Editor.

  2. Click Change Font if you wish to change the font, font size, or text color.

  3. Click OK, and then click on the diagram where you want the comment to appear.

  4. An existing comment can be edited by right clicking on it, then selecting Edit.

  5. The comment box width can be adjusted by dragging the left or right edge with the mouse.

Adding comments from code to your diagram

When you see the comment symbol, it means there is a code comment available for the called method and you can place it on your diagram with the Auto Comment feature.

To add an Auto Comment:

  1. Position the mouse over the method call you want to add a comment for, and then click the right mouse button. Select Comment from code.

  2. Click on the diagram where you want the comment to appear.

Adjusting the layout of your diagram

When your diagram contains all the methods you want to display, you can fine tune the diagram by dragging the object boxes at the top of the diagram with the left mouse button. They are limited to moving horizontally.