Question

I am about to make a UML activity diagram for an old program, full of goto. The program I'm going to model is constructed as in the example. First, it make something, then it check the error flag. And if the error flag is set, it writes an error code to a log and possibly go to another place in the program.

// When error, the program generate a Trap and then go to 1000
err = Foo(A,B,C)
if (err != 0) 
{
   CTrap(2000,err,A,B,C)
   goto(1000)
}

// When error, the program generate a trap and continue
err = Foo2(A,B,C)
if (err != 0)
{
   CTrap(2000,err,A,B,C)
}

CTrap writes an error code to the log, and I want the activity diagram to show the error codes that each activity can generate and when.

Now I have tried modeled this with countless of decisions and merges and added an action for each error code that is written to the log. But it is almost impossible to follow the program then. I could remove the action for the error codes, but then I lose important information. And it is then still countless decisions and merge. I wonder if there is any notation that I can use to simplify it somehow. So it shows the error codes that can be generated and when, without having to flood the chart with decisions and merges. If I can use the post-contion on the error flag in any way, or if you can have multiple outputs from a campaign with conditions on?

Edit

I've experimented a bit by placing information about error codes (Trap) in the comments. I do not know if it is possible to write as I have done? And can I have different outputs from an activity that I have done in some places? Then I wonder if I've been using the "Write Variable" correct? This has been said one experiment, and not a complete diagram.

The functions that is prefixed with BFX is system functions, and function prefixed with BX2 are functions associated with this program. All merge is a GOTO destination. For example the merge called 8100 is a part of the program that handle error situations that you go to with GOTO 8100

My experiment

Was it helpful?

Solution

You can do this using multiple activity diagrams. From your code, you don't want to show the possible errors on the top level diagram, but on the diagram that shows CTrap you can show the possible error codes and what they do.

If you want to show all the information in one diagram there is nothing you can do - the diagram will become pretty cluttered.

Edit (after addition of diagram): you can concatenate the guards in the links so instead of having 4 links outgoing from the junction you get one. Don't think that there is anything else that you can do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top