Geeks With Blogs
Ulterior Motive Lounge UML Comics and more from Martin L. Shoemaker (The UML Guy),
Offering UML Instruction and Consulting for your projects and teams.

We take an unscheduled break from the schedule this week. I'm giving a UML presentation at Ann Arbor Day of .NET, and I need to prepare material for that. So rather than going Back... to the 80s as planned, I'm going to dual-task: the episodes this week will be the slides I'm prepping for my presentation. These were episodes I was going to run eventually; I'm just doing a little time travel.

For today's episode, we have a rerun of Episode 8: Right Court, but slightly abbreviated and redrawn as a Sequence Diagram. (Click the picture for a larger image.)

Episode 10

And now I'm stumped: what can I say that would add to that diagram? To me, at least, it's self-explanatory. Sequence Diagrams were the first real UML diagram where I got the point. Right there, in one diagram, I can see what happens when in the entire episode and who or what is involved when.

But everyone sees from different perspectives. What's obvious to me can be confusing to you, and vice versa. So just in case, I'll walk through the contents and flow of this diagram. If you find this explanation slow and tedious, so do I! Just go back and reread the diagram, and that will make more sense.

  • When you read this diagram, you should see time progressing down the page. The messages (i.e., arrows) near the bottom come after those near the top.
  • The dashed lines under each Actor or Object are called Lifelines. They represent the time the Actor or Object exists within this diagram. When the lifeline ends with a large X short of the bottom of the diagram (as happened to Process Cop here), that indicates the Actor or Object was destroyed during the course of the diagram. (There's also a notation for an Actor or Object getting created in the diagram, but we don't have an example in this episode.)
  • The boxes overlaying the lifelines indicated when an Actor or Object is actively participating in the conversation, even if only waiting for an answer. Thus, we call these Activations. Judge is in complete control of the courtroom, so his single Activation runs the length of the diagram. Other Actors and Objects have shorter Activations, starting when Judge or someone else asks something of them, and ending when they're done with what was asked.
  • The arrows from one Lifeline to another are called Messages, because they show how one Actor or Object asks another to do some work or provide some information. The optional dashed arrows are Return Messages, indicating answers.
  • The Messages that double back to their own Lifeline indicate an Actor or Object talking to itself, asking itself to do some work.

And that's about all you need to know to understand this diagram. So simple, and yet so powerful: in a simple, almost tabular form, you show the steps involved in a process and what parts of the system are involved in that process and what each part does in each step! This is a powerful notation, and is useful well beyond just software design. Any business process can be modeled this way. (Arguably, a Gantt chart is a form of Sequence Diagram rotated so that time flows across the page.)

And as I keep repeating: almost anybody can read a well-drawn Sequence Diagram. In a later episode, we'll look at what goes into well-drawing one.

Posted on Saturday, November 15, 2008 4:56 PM Ulterior Motive Lounge | Back to top

Comments on this post: Ulterior Motive Lounge Episode 10: Rerun!

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Martin L. Shoemaker | Powered by: