Last time we ended with my dilemma either to try and meet a killer deadline or to get sacked. Fibbs, the company’s salesman, managed to sell a software upgrade to an important client. Good job, except that we hadn’t even planned to do such an upgrade. What’s even better, a month’s work was promised to be done, dusted and delivered in just over a week. How about that for a nail-biting cliffhanger? Or is it just me? Probably just me.

You’ve got a message!

An unsettlingly direct message in my case. I can see Fossey, my manager, approaching and I can guess the purpose of his visit.

Sure enough, fixing his eyes on the coffee cup circle on my desk, he asks: “Where are we on the Export to Excel feature, can you give me an estimate of how long it might take us to get that done?” What he means is how long it would take me to get it done and what he is actually telling me is: “You heard Fibbs promise that it would be shipped next Friday. Now tell me it’s going to happen, so I can report it to my boss.”

Messages in UML sequence diagrams are the means of communication between participants in the diagram. They are shown as arrows coming out of a participant’s lifeline and going into another participant’s lifeline. Usually to cause disturbance.

 

What happens when you get a message?

A message typically leads to… “stirrings“, shall we say? A stirring could cause a participant to:

  • come up with some sort of a result, often through calculation

 

  • engage in some other sort of behaviour

 

  • create another participant

 

  • even cease to be

“Coming up with some sort of a result” somehow seems appropriate at the moment.  I assume a serious expression and proceed to click through the project’s schedule on FogBugz to make it look like I’m actually working on it…

“I’d say a week, if we don’t do the formula export…”
What I want to say is: “You know that would take a month in the best of circumstances. I’m telling you what you want to hear only because I have no choice. Could we cut down on functionality? Please?”

Fossey moves his eyes away from the coffee stain, looks at the ceiling, then back at the coffee stain… “Fine, I’ll go tell Fibbs.” To be understood as: “You know this won’t be possible. But it would make me look better, if pressure came from the salespeople.”

 

Types of messages in sequence diagrams

Direct harassment (a tap on the shoulder, for example) is only one way of passing a message to a participant. Just like among people, communication between UML objects can take various forms and this is reflected in the way the messages are drawn on a sequence diagram. In a computer program a message would often represent a function call, so I’m using “message” and “call” interchangeably in this post.

What we saw above was an example of a

  • Synchronous message  – the sender is “blocked” or waiting until the receiver does its work and returns. A synchronous message is the simplest one and most often maps to a direct function call.

That would be Fossey glued to my desk’s coffee stain until he got the estimate he wanted…


  • Asynchronous message is used when the sender can remain running (active) while the receiver is reacting to the call. In programming that could be useful for showing multiple threads of behaviour.

I know what that is! That’s when a tester sends me a bug report, for example… It normally gets me to leave whatever I’m doing and get on with the *** bug, while the tester happily goes on doing whatever a tester does. Filling in *** bug reports.

The same symbol is used when the type of message is unknown or unimportant, so it is also referred to as a generic message.

 

  • A return from a call points from the receiver of a previous message back to the sender. It means that a task has been completed and can also mean that a result has been returned, though the result is not necessary – think about function calls, which may or may not return something.

 

  • A found message is one, whose sender is unknown, but which causes some change in the system.

 

  • A lost message is normally sent to an unknown recipient.

 

  • Timed call – not part of the UML 2.0 standard, but handy for showing that a call will be abandoned, if it is not completed in a certain time.

 

Passing data in messages

Function calls often have arguments passed in them:

func( argument )

This syntax is used when showing a call with arguments on a UML sequence diagram:


Putting it all together

Death and taxes are nowhere near as inevitable as pressure from the salespeople. The next morning I come to work to find voice mail from Fibbs, the salesman, reminding me about the deadline next Friday: “… and yeah, if you could you add a way for the columns to change colors, that would be greeeat.”

Trying not to hyperventilate, I rush to my manager Fossey’s office. Either we should negotiate a new deadline or someone will have to explain to the salespeople that color changing Excel columns are about as useful as an MP3 toothbrush.  Fossey doesn’t seem to be around, so I wait. I’m not leaving until something is done, for goodness’ sake!

Ten minutes later, after having adored the portraits of Fossey’s wife and bulldog on his desk, though still not certain which one’s which, I drag myself back to my desk. To find Fossey waiting for me and staring at my picture of Lara. I equalize before he scores: “Fibb’sjustrequestedmorefeatures. Nowaythiscanbedonefornextweek!” He asks me to repeat and, this time more coherently, I explain the gravity of the situation. He looks at the floor. Strokes his chin. Then strokes his chin some more, while still looking at the floor. Then mutters something about overtime and that rates for that aren’t bad and wonders off.

I pick up the phone and order pizza. See you next Friday…

 Definitions

  • UML – Unified Modelling Language
  • UML Sequence Diagram – a diagram, which describes a scenario in the behaviour of groups of collaborating objects
  • actor – something or someone, interacting with a system, but not part of it
  • lifeline – a line, representing the life span of a participant in the scenario
  • message – a line of communication between participants in the scenario (see “Messages in UML 2.0 Sequence Diagrams” for details on the types of messages and their use)
  • Class Diagram – a digram, which shows classes (object types), participating in a system, their properties and the relationships between them
  • Class Properties represent the features of a class, which can be attributes or associations

 Resources

As much as I would like to take credit for the knowledge in this article, all the UML stuff comes from:

 

The cool cartoons are courtesy of zlotence.

About the Author

Manuel grew up in a small town. Went on to study Computer Science in a low level university in a slightly bigger town. Tried smoking for the first time. Didn't like it. Has been an employee of A Corporation, writing mostly C++ code for the last nine years. Bear with him.