Book a Demo

Author Topic: Request on state elements in sequence diagrams  (Read 4025 times)

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Request on state elements in sequence diagrams
« on: September 17, 2002, 08:14:30 am »
Hi, everybody!

Here's a request for Sparx on sequence diagrams, as well as a work-around for the problem I want to address.

State charts are a powerful tool for analyzing objects with non-trivial life-cycles, but they are oftentimes neglected for a variety of reasons: time pressure, learning curve, and so forth. A good alternative to state charts consists of including the states of objects in sequence diagrams. Rumbaugh and his amigos give an example of this in page 426 of The UML Reference Manual (Addison-Wesley, 1999): interactions with a :TICKET object produce transitions through "unreleased", "available", "locked" and "sold" states .

The way I make use if this technique in EA is as follows: I include a state in a sequence diagram (drag the "State" shape from the State tool bar into the diagram), send a message to the state (in the usual way), and specify "New" in the message's lifecycle Box (so as to force the state to the message's vertical position). I then superpose the state above the corresponding object. For example, I place a "logged_in" state over an instance of "user" class.

This is only a workaround, and any ideas or successful experiences from other EA users will be quite welcome.

To permanently solve the usage of states in sequence diagrams, I would like to see two improvements in EA: first, the state should be displayed with a state shape (as it is correctly displayed in EA state charts diagrams), and I should be able to place it vertically wherever I need it; second, the state should "snap" over the object (since it is the state of a class' instance) and should not have a lifeline of it own.

From my perspective, what I am requesting is not an urgent improvement, since developers are being able to understand  diagrams like the one just described. But I hope that the use of states in sequence diagrams can help the EA community to improve our use of the tool, as well as our productivity. The correct displaying of the state element's shape, and the behavior of the object and its state as a unit will help us in this regard.

A couple of notes of caution, though, for those of you who are using sequence diagrams and would like to include states. First, you should not worry about states until you have a stable use case model; otherwise, you will be doing and undoing a lot of work. Also, you should take into account that it is valid to use sequence diagrams to represent the behavior of either classes or objects. State transitions, however, apply almost always to objects (instances of classes) and not to their classes. This is very logical: when my cat Timoteo falls into the "lazy" state, it does not mean that the whole class of felines falls also into that state as well. So, if you draw a state over a class, some unforgiving zealot might use the opportunity to step on your toes.

Jaime Gonzalez

PS: The only urgent reason for this improvement would be to get it working before Farfetch's boss finds out that Visio does snap state shapes over object's lifelines in sequence diagrams!

Farfetch

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • You are amazed that we exist, that we burn so bright, and you can only wonder why.
    • View Profile
Re: Request on state elements in sequence diagrams
« Reply #1 on: September 17, 2002, 08:19:35 am »
I think all cats routinely fall into a state of sleep 99% of the time :D

Lewis
Farfetch'd is the mightiest of all the Pokemon!!!

P.S. I do have a serious job :)