State Diagram Plug-in

State diagrams are very useful in summarizing the execution states of programs that exhibit a repetitive behavior. The plug-in for generating state diagrams can be download from: State Diagram Plugin. This plug-in requires JDK 1.8 and Eclipse/Luna or Mars.

Uncompress the downloaded file to get a directory named Compare_Design_and_Runtime. Install it using Help-->Install New Software. Click the 'Add' button and enter 'State Diagram' in the 'Name' field. Click on 'Local...' and choose the directory just created. Follow the prompts of the installation wiazard to install the plug-in.

Select Window --> Show View --> Other. You should see the State Diagram View. This indicates that the plug-in has been correctly installed.

There are a number of examples in the Examples subdirectory. Run the dining philosophers example through JIVE. Save the execution trace from the Execution Trace tab. It will save as a .csv file. (A sample .csv file for dining philosophers has been saved in the Examples subdirectory.)

Open the .csv file in the State Diagram View. Choose class 'Philosopher' and field member 'State'. Click the Add button to add the three philosophers' State variables to Varset. Then click Create to see the State Diagram, as shown below (the nodes and edges were re-positioned manually before the screen-shot below was taken).

Use the rewind button to go back to the start and step forward to see the states evolve one at a time.

The plug-in lets you abstract the values of variables and reduce the number of states in the diagram. For example, suppose that we just want to know whether the philospher is eating (E) or not, i.e., we are not interested in whether a philosopher is thinking (T) or hungry (H). Through the 'Abstraction' button we can specify that we are interested only in the condition that State = E for each of the three philosphers. An abstracted state diagram is constructed, as shown below. The notation (! E) means that the value of the State variable is not equal to E.

Compact Sequence Diagram Plug-in

Sequence diagrams can sometimes become long and unwieldy, and hard to comprehend. This plug-in can help construct reduced diagrams, by performing compaction in the vertical and horizontal dimensions.

The plug-in can be download from: Compaction Plugin. Uncompress the downloaded file to get a directory named 'Sequence Diagram Compaction Update'. Install it using Help-->Install New Software: Click the 'Add' button and enter 'Compact Sequence Diagram' in the 'Name' field. Click on 'Local...' and choose the directory just created. Follow the prompts of the installation wiazard to install the plug-in.

After installing, select Window --> Show View --> Other. You should see Compact Sequence Diagram in the menu. This indicates that the plug-in has been correctly installed.

Run a sample program through JIVE. Save the execution trace from the Execution Trace tab. It will save as a .csv file. Open this .csv file in the Compact Sequence Diagram tab and it will show the compacted diagram. A sample compacted diagram is shown below.

JIVE uses regular-expression-like labels for abbreviating a repetitive pattern of calls. For example, in the loop box in the above diagram, the label

(swap:1)^19

means that there was a sequence of 19 calls on the 'swap' method. These 19 calls have been compacted and presented as a single call. The entire sequence of 19 calls could be seen in the Sequence Diagram tab.