5

I want to draw a Sequence Diagram Where

A -> B.run()
B.run() -> B.m1()
B.m1() -> B.m2()

So far I've come up with these.

http://i51.tinypic.com/eja5bl.jpg http://i52.tinypic.com/1449s3.jpg

But Here I cannot mention it clearly that B.m2() is called by B.m1() Rather it looks like B.run() Calls both B.m1() and B.m2() serially.

------------- EDIT ----------------

This is What I Currently have drawn http://i55.tinypic.com/21276kk.jpg

Well Is my Current Diagram Okay ?? What I want is this. (Call Flow)

SpiritAdapter -> SpiritEngine::run(spirit:string, method:string, args[])
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::executeLogic(spirit:string, method:string, args[])
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritEngine::spirit(spirit:string, method:string, args[])
SpiritEngine::spirit(spirit:string, method:string, args[]) -> new SpiritAbstractor
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritAbstractor::method(args)
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::storeXDO()
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Neel Basu
  • 12,638
  • 12
  • 82
  • 146

3 Answers3

6

You can add a small bar over B.m2() and then place a self pointing arrow, for example.

alt text

Self message vs recursive call

alt text

KMån
  • 9,896
  • 2
  • 31
  • 41
  • I am Currently Doing it in this Way. But Its is Called Recursive Message. But These Functions of Mine are not Recursive. So would it be good to have that kind of small Bar ?? or I am thinking wrong about the Term `Recursive` it actually means same object not same method ?? – Neel Basu Sep 21 '10 at 11:39
  • See updated answer. Checkout: http://www.visual-paradigm.com/VPGallery/diagrams/Sequence.html#recursive_message – KMån Sep 21 '10 at 11:44
  • @user256007: 'recursive' term is misleading. Self messages in UML are used to indicate any call from an object to itself. Doesn't have to be the same method. Based on your original post, self message syntax (as shown in examples) is appropriate. – sfinnie Sep 21 '10 at 12:13
  • @sfinnie: This isnt misleading. Self Messages are an arrow to itself; while Recursive are arrow to a bar on self. See self message(http://www.visual-paradigm.com/VPGallery/diagrams/Sequence.html#self_message) and recursive message(http://www.visual-paradigm.com/VPGallery/diagrams/Sequence.html#recursive_message) – KMån Sep 21 '10 at 12:39
  • @Kman: er, yes it is. As with many areas of UML, the semantics aren't clear. To quote the text associated with your 'sd Recursion' snippet above (from Sparx site): "A self message can represent a recursive call of an operation, or one method calling another method belonging to the same object. It is shown as creating a nested focus of control in the lifeline’s execution occurrence.". The VP site characterises the difference based on an "activation". Which in turn needs a definition of "activation". A self-method call is valid as an activation.... – sfinnie Sep 21 '10 at 13:48
  • 1
    ...so to answer @user256007's original question: is it appropriate to use the nested lifeline idiom to illustrate an object calling a different method on itself? Yes. – sfinnie Sep 21 '10 at 13:57
1

The uml spec allows for a nested call to be shown visually: the called lifeline should be overlaid on the calling lifeline. See e.g. determineAvailableReport() call in this example.

Whether your tool supports it of course is another matter...

sfinnie
  • 9,854
  • 1
  • 38
  • 44
  • Yes. But per comment above, 'recursive' is misleading. It's a self call, doesn't have to be the same method. – sfinnie Sep 21 '10 at 12:14
0

Lets say ObjectA has 3 methods called MessageOne(), MessageTwo() and MessageThree().

And the relation between them are shown below

void ObjectA::MessageOne()
{
    MessageTwo();
}

void ObjectA::MessageTwo()
{
   MessageThree();
}

void ObjectA::MessageThree()
{
   // TODO
}

Using Enterprise Architect as shown in the image below if you select MessageThree() call you will get an option to raise the activation level.

enter image description here

Once you choose that option(By clicking on -> arrow) you will get the exact diagram(Shown below) which satisfy sequence diagram of call stack.

enter image description here

Jnana
  • 824
  • 13
  • 12