OU blog

Personal Blogs

Christopher Douce

UML Sequence Diagram goose-chase

Visible to anyone in the world

Over the last couple of months, I’ve been updating block 2 of the TM354 module materials as a part of a module refresh. This has meant I’ve had to reacquaint myself with the Unified Modelling Language (UML), which I first learnt as a postgraduate student. I went onto use UML for a short time when I worked as a software developer in industry. It’s a really useful tool; it provides a neat graphical language that helps software engineers to communicate with each other when put pen to whiteboard.

UML describes the structure of a number of diagrams. To explain everything very coarsely, there are two main types of diagrams: structural diagrams (which describes what something is), and behavioural diagrams (which describes what something does).

Introducing the sequence diagram

One of the behavioural diagrams is a sequence diagram, which is a ‘type of’ interaction diagram. A sequence diagram can show what messages can be passed between which modules at a particular moment in time.

Objects are presented using something called lifelines. Messages that are sent between objects are presented using arrows. There is a special type of message, which is called a create message, which (unsurprisingly) creates a new object, which is depicted as an object with a new lifeline.

Books and tools

One of my ‘go to’ books is UML Distilled (OU Library). I have a 2nd edition copy of the physical book, but more recently I’ve been referring to the 3rd edition which I can access through the OU library.

A tool I’ve started to use is Visual Paradigm (which is also used in M814 Software Engineering, the postgraduate module). Visual Paradigm enables me to draw UML diagrams, including sequence diagrams pretty easily.

Sequence diagrams can depict the creation of new objects, by the creation of a new lifeline. UML Distilled says that a ‘solid’ line is used. Visual Paradigm, on the other hand, insists on using a ‘dashed line’. After an hour of fighting with Visual Paradigm, and uncovering some relevant documentation, it would not relent. 

Which one is correct?

Digging into the standard

After a bit of digging, I discovered that someone else has been asking the same question (Stackoverflow).

One of the replies directed me to the UML 2.51 specification (PDF).

Page 577 contains the following line: ‘An object creation Message (messageSort equals createMessage) has a dashed line with an open arrow head.’

My conclusion? Visual Paradigm implements a more recent version of the UML language than is described in my textbook.

Reflections

Does all this matter? Yes, and no. It depends on how you use UML.

If you use sequence to occasionally figure out what is happening within a nest of objects, drawing informal diagrams for either yourself or other developers that you work with, it won’t matter whether you use dashed or solid lines.

If you apply UML in a more formal way, it might matter.

My own view is that I prefer the solid lines. I’m more familiar with dashed lines showing the return control flow from objects. On the other hand, a different line highlights a ‘special’ function, of which object creation is one of these. 

Permalink Add your comment
Share post

This blog might contain posts that are only visible to logged-in users, or where only logged-in users can comment. If you have an account on the system, please log in for full access.

Total visits to this blog: 2505264