How to destroy a participant?

0 votes
asked Jun 5, 2018 in Question / help by anonymous
Hello.  Thanks for this wonderful tool that is easy to use!  Anyways, I have a question:

In a sequence diagram, we can 'create' a participant so that its first appearance is not at the top of the diagram, but at the moment of creation.  Now is there a way to destroy a participant so that it disappears at the moment of destruction?  I would like to show that a temporary helper class/instance is created and after a certain time destroyed.  The create command allows me to the former, but I can't find the latter.  I plan to show  a create/destroy pair twice in a sequence diagram.

is there such a way?  Thanks.

1 Answer

0 votes
answered Jun 8, 2018 by mgrol (3,150 points)

Hi,

I assume this is what you want:

@startuml
Bob -> Alice : hello
create dummy
Alice -> dummy
Alice <-- dummy
destroy dummy
Bob <- Alice
Cesar -> Cleo
create dummy
Cleo -> dummy
Cleo <-- dummy
destroy dummy
Cesar <-- Cleo
@enduml

This can be easily found here http://plantuml.com/sequence-diagram, just search for "create" or "destroy"

BR,

Michael

commented Jun 3, 2020 by anonymous
The last destruction does not really destory, it remains till the bottom. Moreover, I cannot reuse the column for a different termporary object later.

Something like this:

@startuml
Bob -> Alice : hello
create dummy order 1
Alice -> dummy
Alice <-- dummy
destroy dummy
Bob <- Alice
Cesar -> Cleo
create Zummy order 1
Cleo -> Zummy
Cleo <-- Zummy
destroy Zummy
Cesar <-- Cleo
@enduml

Without this feature, the my diagram will grow needlessly wide. I will probably need to split it into several smaller diagrams then.
commented Jun 10, 2020 by The-Lu (64,340 points)
edited Jun 10, 2020 by The-Lu

Hello All,

From:

A funny workaround is to recreate, at the end, the participant and to crop the final image!
But that is only a funny workaround! wink

|||
== Cut here ==
create dummy
Cleo -[hidden]> dummy
create Zummy
dummy -[hidden]> Zummy
== Cut here ==

[Click to see on online server]

If that can help,
Regards,
Th.

...