aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes UML sequence diagram help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "UML sequence diagram help" Watch "UML sequence diagram help" New topic
Author

UML sequence diagram help

Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Here's the non-programmer in me putting myself to shame. I don't know how to write UML sequence diagrams

I'm trying to write my first one to describe the flow of logic in a Java web application framework. In words it goes like this:

Request hits front controller
Front controller uses an ActionDispatcher (helper) to forward the request to an ActionController
ActionController may (optionally) ask the ActionDispatcher to foward the request elsewhere (repeat any number of times).
FrontController forwards to a JSP file to compose the view.

The bit I'm getting mixed up on is how to draw step 3 where the ActionController may effectivey jump backwards a step over and over.

Here's what I have so far:



I know some of my boxes should have underlines in them... I just have't figured out how to do that in the software I used yet
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Scott Ambler's Introduction to the Diagrams of UML 2.0 has a couple examples of looping in Sequence Diagrams. Yours sounds like a loop-while kind of guard. See if that helps.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Brilliant thanks Would I be right to be getting the feeling that people don't always write UML following a completely strict set of rules? It's more about how well it conveys what it's diagramming?

I simplified my attempt by dropping mention of the factory (that was a little too close to an implementation detail for my liking) and emphasing the loop.

Does this make sense to anybody other than me?


[ August 27, 2007: Message edited by: Chris Corbyn ]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Chris Corbyn:
Would I be right to be getting the feeling that people don't always write UML following a completely strict set of rules? It's more about how well it conveys what it's diagramming?


Yes, absolutely.

It also depends on what UML is used for: http://www.martinfowler.com/bliki/UmlMode.html

A nice, more lightweight diagramming syntax for simpler diagrams can be found at http://agiledraw.org/ (it currently has some server problems, I have contacted the admin about it).

As an aside, are you sure what you have is a loop? It sounds more like a recursion to me (not sure how to show that in a sequence diagram, sorry...).


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Yes, it is recursion. It's basically a filter chain, except there's no chain defined up-front. ActionDispatcher passes itself ('this') to ActionController, so if ActionController invokes its forwardToAction() method no loop has occurred, it's recursed back into the ActionDispatcher... I guess I could just change "loop" to "recursion". I have a feeling I've seen a little looped arrow to indicate recursion at a particular unit so I could probably stick that on the grouped box instead.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Back when I was doing a lot of diagramming I made liberal use of comments. The new fangled UML 2.0 has new decorations and shapes to indicate a lot of the things I just described in text. As long as the model doesn't have to compile and run (MDA) you only get "graded" on how well readers learn what they need to know.
 
 
subject: UML sequence diagram help