09 September 2010

Sequence Diagram: DSL or not DSL ?

I had to produce some UML Sequence Diagram and I tested some Graphical and command line tools.
With UML tools there are 3 possibilities (sometimes mixed in a single application):

  • Draw your diagram (UMLet, ArgoUML, Violet ...)
  • Reverse engineer your code. It can work for Class Diagram, but the result for Sequence Diagram is generally unusable. (ArgoUML ...)
  • Describe your diagram in a DSL (PlantUML, UMLGraph, ...)
There is no "Best Option" since it depends on your use case:
  • for quickly puting an idea on paper, I like UMLet very much for Class, Component ... But I have to admit that VioletUML is way better for Sequences ! 
  • When I want to keep my diagram in sync with the code and documentation. The DSL/Reverse Engineering approach allow me to put the diagram description in the JavaDoc. The setup in the Maven POM file (with UMLGraph, should be possible with PlantUML too).
  • I never have the case where a DSL would be that useful. But you just got all the benefits of text files obviously: diff, grep ... and some tools allow you to embed your description in Wiki, LaTex, Word ... (PlantUML).


I tested several DSL:

I have to admit that I am a bit deceived with the current state of DSL for Sequence Diagram.

  • They are not that obvious. The easiest is "Client -> Server : HTTP request" with PlantUML. But with SDEdit you would read: "Client:Server.HTTP request" !?
  • They could do more (like automatically activating the lifeline upon message reception). With PlantUML you pollute your description with numerous "Activate Server" ; "Deactivate Client" ...
  • They quickly becomes hard to read and maintain. Two main problems:
    • If you send a message at the beginning and got the response at the end. The message/response link is lost in the distance introduced by all the dialogs in between. You can use indentation, but it is up to you, not a DSL feature.
    • When you have parallel executions or interlinked messages, even the indentation won't be a solution. I don't even see how it could be solved.
  • You really need to see the resulting diagram as you type, if you don't want to end with a lot of rework.
  • The tools I used didn't show you the result "out of the box". You have to setup some schell scripts or other tools. (SDEdit being the exception.)
I think that it is not an inherent problem with DSL. But we didn't find a suitable DSL for Sequence Diagrams and an intelligent application that would really understand Sequence Diagram, and not just describe lines with labels. This would introduce more constraints. There are certainly things that we wouldn't be able to describe as we want, but it should solve 80% of the cases hopefully.
Post a Comment

October summary - 2017-10

10 October Science Looks like the p-value has been under fire for years. https://www.nature.com/news/one-size-fits-all-threshold-for-p-value...