Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

SDL Input and SDL Output in Activity Beta

0 votes
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.
asked Sep 9, 2013 in Wanted features by Luc Trudeau (460 points)
edited Sep 9, 2013 by Luc Trudeau

3 Answers

0 votes

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?

answered Sep 11, 2013 by Luc Trudeau (460 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

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

 

 

answered Sep 12, 2013 by Luc Trudeau (460 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!
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

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;

 

answered Sep 12, 2013 by plantuml (37,290 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.
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.
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 ?
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.
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
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)
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...