Rosario - Create Sequence Diagram from Existing Code

Located on beautiful Orcas Island in Washington State's San Juan Islands, Rosario Resort & Spa has long been a favorite destination for travelers seeking relaxation and unparalleled beauty in the Pacific Northwest.

Anyway, lets look at some other kind of "relaxation and unparalleled beauty", create Sequence Diagram from Existing Code. smile_teeth

The scenario this feature supports is the same as the physical class diagram and the Architectural Explorer, help people understand and evaluating a implementation / architecture of existing code by visualizing it.

The dependency matrix visualizes dependencies between artifacts, the physical class diagram visualizes the static relations between objects and a sequence diagram visualizes its dynamic behavior.

How does it work?
The Architecture Explorer has set of commands, with one of it "Insert into Active Diagram". This command creates a sequence diagram from the method you have selected [see image]. Nice thing to know, this set of commands is extensible..! more on that in the future.

ap

After adding an empty sequence diagram and selecting the command, it creates indeed the sequence diagram [image below]. I used the "drag and drop" front-end implementation, the same one I used for the dependency matrix post and the code metrics post.

sq

This diagram doesn't show return types and parameters. For example the Lookup method look like this in code:

employee = employees.Lookup(txtFirstName.Text, txtLastName.Text);

 

Not that exciting, but it would help in understanding the code. Something like this...

seq by hand
[Always wanted to do this, use my tablet to sketch UML diagrams. Probably the last time... took me half an hour to draw this]

Another process to get there...
The physical class diagram [one to one representation of the code, see image below] has a new menuitem  "Add to Logical Class Diagram...".

2Class

When putting all the necessary classes on the Logical Class Diagram. You can create a LifeLine for it... see menuitem "Create Lifeline..."

2lcd

From there we can draw the interaction between those classes... and now we've got access to the operations in the classes [see dialog].

You can see that there are connected to the logical class diagram by the little "shortcut" icon on the classes.

2sq

What actually would be an interesting scenario... generate sequence diagram, generate physical class diagram, add these classes to the logical class diagram... and let these two logical diagrams work together.

More to come...
Anyway, this "drag and drop" implementation isn't that suitable to demonstrate the capabilities of the "generate sequence diagram" feature... So, next post the more sophisticated implementations... for now, looks good and time to get prepared for Vicky's birthday and Queensday smile_party...

Comments (6) -

Hi Clemens,

Would you happen to roughly know when this VS edition with the UML would be released? I'm using another tool right now, and I'd hate to redo the diagrams and models.

Thanks,
cp

I really don't know when this release will available...  when you look at the release cycles of Visual Studio [every 2 year a new release... 2003 2005 2007] you can make a guess when this version will be available Wink

forgot to mention... most of the UML tools have somekind of XMI import / export...

thank you for sharing information


I’m really impressed with your article, such great information you mentioned here, thanks for your sharing and waiting to see your future posts.

Add comment