Is this correct UML Sequence diagram?

829 views Asked by At

I am at the phase where I need to draw sequence diagrams. The problem to me is how to draw it in correct way. I do understand how they work and have decent understanding of each symbol, but I don't know how some things should be represented.

I have this pseudo code:

procedure Spawner.act(delta: float)
    foreach queues in this.spawerQueues do
        if( queue.isReady(delta) )
            Enemy e ← queue.spawn()
            if e is not null then
                this.world.addEnemy(e)
            else 
                this.removeQueue(queue)
            endif
        endif
    endforeach
endprocedure

procedure SpawnerQueue.spawn()
    if this.size > 0 then 
        return new Enemy( ... )
    return null
endprocedure

And I draw this diagram. Sequence diagram for Spawner.act procedure

Is this diagram correct? Does it need corrections? And if this diagram is wrong, could you provide correct one. I should mention I am using Enterprise Architect 7.5.

1

There are 1 answers

0
qwerty_so On

Doesn't look too bad. The only thing is that the object life is broken after return from spawner. There is some option "Activation/Extend down" in the context of the first return message which you must tick (EA 7 is quite outdated, we're at 12 right now).