I’m the kind of person who likes diagrams. Being a geek I often need to draw diagrams of all sorts and having wrestled with a variety of system design and UML design tools I’ve generally found that they’re more trouble than they’re worth.
I mean, sure, in theory, I could model the entire system in them, but actually I just need one diagram to explain one little thing and no, I don’t want to explain what that blob is, it’s just a blob and it talks to that other blob, and well…I’m sure you see.
Currently one of my personal favourite tools for sequence diagrams is Web Sequence Diagrams. It’s online, has a variety of pretty styles and allows me to draw a diagram simply by describing it in text. For instance in order to draw this:
I write this:
note right of A
Now I recently needed to draw a diagram very similar to the above but in this case the tool being used was SDEdit. It’s an open source tool and works similarly to the web tool in that you describe the diagram in text and it draws a picture for you. Its syntax is a little more complicated, so the same sequence looks like this:
You’ll see I had to declare my objects first (and give them classes), then specify my two calls with their return values and then add my note.
Except that the diagram it actually draws is:
I wanted my note under those responses; so I trawled through the help and (of course) Googled looking for ways to move the note after the return arrows but nothing was forthcoming. So I started experimenting (hacking).
Now it may be that there’s a more elegant way of achieving this (in which case someone should document it) but what I came up with was this:
Note the “A:” this appears to be enough to tell it that control has returned to A and so send those pesky returns before drawing the note.
However if there’s a better way to achieve this I’d love to know what it is.
This is one of those blog posts that I wrote in the hope that it will come up in the Google search next time I’m trying to achieve this!