Left-to-right bias in UML sequence diagrams

Have you ever noticed how UML sequence diagrams always assume a left-to-right reading direction? If you’re used to reading texts from left to right, you probably haven't.

But some scripts like Hebrew and Arabic are read from right-to-left. So what should a UML sequence diagram for a right-to-left reading audience look like?

This article gives an overview of the issues and briefly highlights Trace Modeler's "Layout direction" style setting and script support.

Watch a 30 sec demo

Start using Trace Modeler today

30-day fully functional trial
No installation required!

Left-to-right diagram layout

Here's a typical UML sequence diagram :

UML sequence diagram with a left-to-right layout

As you can see, the left-to-right bias is present in the following areas :

  • the general direction of call arrows is left to right
  • the interaction starts at the left side, as do found calls (usually)
  • reentrant activations are displaced to the right
  • message numbers are placed to the left of a message's label
  • the top-right corner of comment symbols is folded over
  • the operator of a combined fragment is placed at the top-left
  • the guard of an operand is placed at the left (although this is debatable)
  • the label of a diagram frame is placed at the top-left

The examples in the UML superstructure specification also display this bias, as do all the other sequence diagrams I've encountered over the years.

Creating a right-to-left diagram layout

While I was working on Trace Modeler's automatic layout algorithm for sequence diagrams, I got curious how a diagram with a right-to-left reading direction would look. The web had nothing to offer on this matter, which is odd considering that a large number of developers use right-to-left script in their daily lives. So I decided to try it out myself…

I added a simple diagram property to Trace Modeler that allows users to choose between left-to-right and right-to-left diagram layout directions.

Trace Modeler's diagram style window with the layout direction setting highlighted

Simply by changing the layout direction setting in the ‘Diagram style’ window, the earlier diagram is automatically transformed into the following :

UML sequence diagram with a right-to-left layout

Of course, this looks better with a right-to-left-script such as Arabic, Hebrew or Urdu.

For more realistic examples, have a look at some of the right-to-left diagrams in the gallery :

Looking for a better UML sequence diagram editor?

Watch a 30 sec demo


Right-to-left scripts

Incidentally, right-to-left scripts are also supported :

  • Trace Modeler offers bi-directional text editing, you can even mix different scripts in the same text labels
  • The user interface adapts to the user's reading direction as set by the operating system
  • you can switch on the fly between a left-to-right and right-to-left diagram layout direction

The screenshot below shows what Trace Modeler would/should look like in a right-to-left operating system context (simulated as I do not have such a system).

I've also had to photoshop it slightly because the UI library I'm using, has a bug which messes up the window's title bar under such conditions :-(.

By the way, I'm still looking for beta testers who have their operating system set for right-to-left script, contact me if you're interested.

Screenshot of Trace Modeler on a system with a right-to-left script

What do you think?

To my knowledge, Trace Modeler is the only tool that supports this diagram layout direction for sequence diagrams.

I’m actually not in a good position to judge the usefulness of this feature as I’ve been using left-to-right scripts all my life. But it seemed like an interesting experiment and it didn’t take all that long to implement - initially...

I'm wondering if this new diagram layout feels more natural for users of a right-to-left script. So if you’re used to working with such a script, let me know what you think of this feature!

Send in your comments and I'll add them below.

Reader comments

Bram Adams wrote :

What about top-to-bottom scripts :-) ?

Yanic answered :

Nice one Bram.. Choose right-to-left layout and turn your monitor on its side, counter-clockwise ;)

Eugene Kuleshov wrote :

I also was wandering why sequence diagrams aren’t vertically oriented. It may help to make them more compact and more natural, since time is usually shown in horizontal axis…

Yanic answered :

My guess would be that it’s more natural for the orientation to follow the reader’s preferred reading direction, i.e. a vertical orientation would fit better with a vertical script.

There are two possible combinations of a vertical orientation (i.e. vertical arrows) and horizontal scripts :
(1) call labels parallel to the call arrows
(2) call labels orthogonal to the call arrows

The net result of (1) would resemble a horizontally oriented diagram with rotated object labels. That way you would gain horizontal space by sacrificing some vertical space, which might be a good trade-off if you have a lot of objects but relatively few arrows.

With possibility (2), call labels would cross multiple call arrows and make the diagram more difficult to understand I think.

Watch a 30 sec demo


Article copyright © Yanic Inghelbrecht 2007-2008, www.tracemodeler.com | last updated on 06/07/2008