Activity Diagram input/output

+1 vote
asked Aug 28, 2014 in Wanted features by sberke (160 points)

Request to support input and output parameters and objects in Activity Diagrams.

Personally I prefer the object designation without pins.

Request includes:

  1. input/output objects & parameters of the Activity Diagram (higher priority)
  2. input/output objects within the Activity Diagram (nice to have, but example #3 below is a good example of how it would be helpful between swimlanes)

Examples:

  1. Input parameter "Requested Order" http://www.sparxsystems.com/resources/uml2_tutorial/uml2_activitydiagram.html
  2. From: http://www.omg.org/cgi-bin/doc?formal/2007-02-05
    1. Figure 12.54 - Presentation option for flows between pins and parameter nodes
    2. Figure 12.55 - Example of activity parameters.nodes
    3. Invoice in Figure 12.59 - Activity partition using swimlane example

1 Answer

+1 vote
answered Aug 28, 2014 by plantuml (298,440 points)

Thanks for the idea.
Using the :foo] syntax, you can somehow have Parameter and Objects in activity diagrams.
The issue is that you can have only one parameter.

For example, about Input parameter "Requested Order", you can have something like:

:Request Order]
partition "Process Order" {
    start
    :receive order;
    if () then (order accepted)
      :fill order;
    fork
    :ship order;
    fork again
    :send invoice;
    : __Invoice__ ]
    :Make payment;
    :accept payment;
    end fork
    else (rejected)
    endif
    :close order;
    stop
}




Or with goto (not yet working...) :

:Request Order]
partition "Process Order" {
    start
    :receive order;
    if () then (order accepted)
      :fill order;
    else (rejected)
      goto a
    endif
    fork
    :ship order;
    fork again
    :send invoice;
    :Invoice]
    :Make payment;
    :accept payment;
    end fork
    label a
    :close order;
    stop
}




Not the same drawing, but close enough.

About figure 12.59, you can have:
(some arrows after "fork" are not drawn in the current version, but this is solved in the beta, and will be ok in next release)

|Order departement|
    start
    :receive order;
    if () then (order accepted)
      :fill order;
    fork
    :ship order;
    fork again
|Acctg departement|
    :send invoice;
    : __Invoice__ ]
|Customer|
    :Make payment;
|Acctg departement|
    :accept payment;
    end fork
    else (rejected)
    endif
    :close order;
    stop



Not perfect yet...

We are interested in having feedback on those example. If you have suggestions for syntax or drawing, please go on!

Regards,
 

commented Aug 30, 2014 by sberke (160 points)
edited Aug 30, 2014 by sberke
Thanks for the reply.

The workaround in the first example is a good stop gap as the ;input object] and ;__object__] usages are helpful.

Other usage that hits a comparable limitation is the ability to create an orphan activity for "Time Event" & "Receive Signal Action" (Ref: http://www.sparxsystems.eu/resources/project-development-with-uml-and-ea/activity-diagram/)

:timeout<   syntax can be used, but I tried to no avail to use syntax such as 'kill' to create an activity with no explicit control flowing into the activity.

So, different usages then the input/output objects but potentially a solution can address both the Signal/Time Event actions & having parallel activities to allow multiple inputs, but I suppose the following is another workaround:

fork
  :session ID]
  fork again
    :Request Order]
end fork

Not sure how 'goto' applies to objects & parameters.

What I like about 12.59 & Fig 7 (http://www.sparxsystems.eu/resources/project-development-with-uml-and-ea/activity-diagram/) is how objects/parameters straddle the boundary to show the inputs/outputs of the activity or system.  

For example, the input of this activity is :Money] and the output is a :Can of Soda] and :Change]

:Money]
partition "Buy a Coke" {
    start
    :Insert Money;
    if () then (Money Valid)
      :Select Drink;
    :Dispense Drink;
    : __Can of Soda__]
    if (Exact Change Used?) then (No)
    :Dispense Change;
    :__Change__]
    else (Yes)
    endif
    else (Money Not Valid)
    endif
    :Close Order;
    stop
}
fork
:Can of Coke]
fork again
:Change]
fork end

What I suspect is needed includes:
- draw object
- specify object as input to activity
- specify object as output to activity
- specify object on border of partition
- specify object on border of swimlane
- specify event/signal

As far as suggestions for syntax...a few strawman ideas:

Alt1: object begin/end
object
  Money
end object
:Insert Money;
...

    :Dispense Drink;
    object
      Can of Soda
    end object

Alt2: object attributes

partition "Buy a Coke" [input] Money, [output] Change, [output] Can of Soda {
  start
  :Insert Money; [input] Money
...
  :Dispense Drink; [output] Can of Soda
...