SDL Input and SDL Output in Activity Beta

0 votes
asked Sep 9, 2013 in Wanted features by Luc Trudeau (360 points)
edited Sep 9, 2013 by Luc Trudeau
Very few free tools allow SDL modeling, I'm not asking for full SDL support ( That being said, it would be awesome). However, just by adding SDL Input and SDL output to the UML Activity diagram would allow for some pretty decent SDL modeling.

Another big step toward SDL diagrams would be SDL procedure calls (a box inside a box).

For more information on SDL modeling (see figure 5 for SDL Input, SDL output and Procedure calls)

http://its.lnpu.edu.ua/edocs1/new_doc/en/Broek%20R.SDL%20basics.pdf

Thank you very much for the great software.
commented May 2, 2022 by Vance
The SDL works well, thank you. One thing which I miss however is directional input/output.

In many use cases we model B in an A <--> B <--> C scenario. In an SDL diagram we like to use horizontally flipped symbols which show the messages/events to/from either the left (A) or the right (C):

>Msg from A]

[Msg to C>

[Msg from C<

<Msg to A]

3 Answers

0 votes
answered Sep 11, 2013 by Luc Trudeau (360 points)

Hi again, 

I really want to have SDL support in plantUML for my students, so I started implementing it

 

I made an USDLInput class and a USDLOutput class that both extends UPolygon. I don't really know what syntax would be ideal for SDLInput and SDLOutput in PlantUML, so I hijacked the Activity to change the object when the activity begins with (+ or -).

What would be a better notation? How would I go about implementing it?

commented Sep 12, 2013 by plantuml (295,000 points)
First, glad that you made the change!
As you have guess, the more difficult is not to implement this, but to think about the syntax.
We could use stereotype to denotate the shape of the activity. For example : <<SDLInput>> and <<SDLOutput>>

@startuml
start
<<SDLInput>>:First Activity;
:Second Activity;
<<SDLOutput>>:Third Activity;
@enduml

BTW do you want to have this in the "classical" activity syntax (http://plantuml.sourceforge.net/activity.html ), or the "beta" activity syntax? (http://plantuml.sourceforge.net/activity2.html ) ?
0 votes
answered Sep 12, 2013 by Luc Trudeau (360 points)

I like the Stereotype idea. I'm propably doing it wrong, but I change the shape in FtileBox in the 

public TextBlock asTextBlock() {

   return new TextBlock() {

      public void drawU(UGraphic ug) {

Method. I guess I would need to decode the stereotype in the Display Object.

 

I've implemented my solution with both syntax. The new syntaxe works best.

I added some more shapes SDLProcedure, SDLSave, SDLContinuous, and I added a task (which is just a Rectangle without rounded corners).

You can now make some pretty decent SDL Process Diagrams

My syntax is 

@startuml

 

:Ready;

:|next(o);

:Receiving;

split

 :>nak(i);

 :<ack(o);

split again

 :>ack(i);

 :|next(o);

 :_i := i + 1;

 :<ack(o);

split again

 :>err(i);

 :<nak(o);

split again

 :$*;

split again

 :{ i > 5;

stop

end split

:-;

 

@enduml

 

 

commented Sep 12, 2013 by plantuml (295,000 points)
Well, I really like your syntax : it's less verbose than stereotype.
Your suggestion is very good,

The only change I would suggest is to change the way you use the < > | / $ symbols.

The idea is to keep the text diagram source close to the graphical rendering.

The current version of beta activity use ; as ending character, and we could extends this to enable other characters that would impact the box rendering.

So, using your example, I would suggest:

@startuml
:Ready;
:next(o)|
:Receiving;
split
 :nak(i)<
 :ack(o)>
split again
 :ack(i)<
 :next(o)|
 :i := i + 1]
 :ack(o)>
split again
 :err(i)<
 :nak(o)>
split again
 :*\
split again
 :i > 5}
stop
end split
:-;
@enduml

My idea is that
:nak(i)<
is visually closer to the graphical result than
:>nak(i);

It's not very different from your initial suggestion. What do you think about it ?
Any idea/remarks welcome!
commented Sep 12, 2013 by Luc Trudeau (360 points)
I really like your notation!

Another idea, following your previous comment was to put it before the ":" like the stereotype

<:nak(i);

This way we can use more characters for example the continuous symbol could be

<>:i > 5;

Another issue I'm having is drawing my procedure box. With the polygon it does not look right because I'm going over the same path twice. With a Path, using the SEG_MOVETO, I get around this problem, but the Shadow is not right and the sides of the inner rectangle are bigger. Any ideas?
0 votes
answered Sep 12, 2013 by plantuml (295,000 points)

With your code (many thanks, its really save us time), we were able to create a beta version : https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

This version support the following syntax:

@startuml
:Ready;
:next(o)|
:Receiving;
split
 :nak(i)<
 :ack(o)>
split again
 :ack(i)<
 :next(o)|
 :i := i + 1]
 :ack(o)>
split again
 :err(i)<
 :nak(o)>
split again
 :foo/
split again
 :i > 5}
stop
end split
:-;
@enduml

First, we could not use the \ as ending character, because this character is used to span lines ( http://plantuml.sourceforge.net/qa/?qa=208/ability-to-span-lines )

This version is not the final/official release for this syntax. We provide it to let people play with it : this is usually a good way to have several new ideas/suggestions.

About the suggestion to replace the first character ":" by something else, like in

 <nak(i);
 >ack(o);

or (more verbose):

 :<nak(i);
 :>ack(o);

It might be a good idea, but you have to keep in mind that the plantuml parser has to guess which diagrams has to be produced (sequence? class? usecase?) and we have to pay attention to not allow ambiguous syntax that may be interpreted be several kind of diagrams.

So do use this beta version, and we are very open to other suggestions, like this one (that we did not understand, sorry...):

<>:i > 5;

 

commented Sep 12, 2013 by Luc Trudeau (360 points)
Wow! Thanks you. I will be able to use it in my class.

What I meant to say with:
<>:i > 5;
is to put the symbole before the ":"
for example
<:nak(i);
>:ack(o);
This way you keep the label clean.

I'm playing with your build. I can see your SDLProcedure is better than mine :). Great work.
commented Sep 13, 2013 by Luc Trudeau (360 points)
Hi again,

I was wondering If I could have the WAR file, I would try to have it deployed at my school so students could use it.
commented Sep 13, 2013 by plantuml (295,000 points)
The best option is to take the actual .war file, to unzip it, to replace the existing plantuml.jar by the beta one, and to zip it again.
Is it ok for you ?
commented Sep 13, 2013 by Luc Trudeau (360 points)
Yeah, no problem. I was thinking about doing that. But I was afraid of it causing bugs.

I looked at your sources on sourceforge and I don't see the changes. Are they hosted elsewhere? If I have access to them I would gladly keep adding more stuff. But I can also wait for your next stable release.
commented Sep 13, 2013 by Luc Trudeau (360 points)
edited Sep 13, 2013 by Luc Trudeau
Ok, I got the servlet working with Jetty 8. I had to remove the footer.jspf it was crashing.

I compiled the war using maven. This is the link if someone wants to try it out

https://dl.dropboxusercontent.com/u/3014819/PLantSDL/plantuml.war
commented Sep 13, 2013 by plantuml (295,000 points)
The code has just been committed on sourceforge.
http://sourceforge.net/p/plantuml/code/HEAD/tree

The code is not very clean (yet) but you modify it if you wish and send it us back.
We will probably refactor it latter.
You may have a look in BoxStyle.java (for the drawing), and in CommandActivity3.java (for the parsing)
commented Jun 17, 2016 by AcceptSocket (120 points)
Thank you for adding SDL shapes.

Somehow I think the shape for SDLSave should be flapped.

Now we use character "/" for SDLSave, but the shape we got looks like a back slash, not a forward slash, which in my opinion is opposite to SDL standards.

Will this be changed in future?
commented Jun 19, 2016 by plantuml (295,000 points)
Sure!
With last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
You can now have:

@startuml
start
:foo/
:bar\\
end
@enduml

The backslash must to be escaped (so 2 backslashes) because it's used by the preprocessor to indicate that two lines should be merged.
Is this working for you ?
commented Jun 19, 2016 by plantuml (295,000 points)
I forget to say that in this beta we have inversed the meaning of / and \\
It looks more logical, even if it slightly break diagrams compatibility.
Anyone is ok with this new meaning ?
...