Book a Demo

Author Topic: return call attachs to incorrect activation level  (Read 4401 times)

hal2000

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
return call attachs to incorrect activation level
« on: June 15, 2004, 07:29:14 pm »
Hi there,
I'm a new user to EA.  Sorry if this question seems a bit repetitive but the other similar topics do not seem to answer the problem I have.

I cannot seem to return messages to attach to the same activation level that they were called from.

This is what  I want to be able to do:

+---------+     +---------+
|   :A    |     |   :B    |
+----+----+     +----+----+
     |               |
    +++ Self-Call    |
    |#|------+       |
    |#|      |       |
    |#+-+    |       |
    |#|#|<---+       |
    |#|#|            |
    |#|#|   Call    +++
    |#|#|---------->|#|
    |#|#|           |#|
    |#|#|           |#|
    |#|#|  Return   |#|
    |#|#|<----------|#|
    |#+-+           +++
    |#|              |
    +++              |
     |               |

I would like the Return from the Call to class B to attach to the nested activation level (due to the self-message eariler on) which will then finish.

What I seem to get in EA is this:

+---------+     +---------+
|   :A    |     |   :B    |
+----+----+     +----+----+
     |               |
    +++ Self-Call    |
    |#|------+       |
    |#|      |       |
    |#+-+    |       |
    |#|#|<---+       |
    |#|#|            |
    |#|#|   Call    +++
    |#|#|---------->|#|
    |#+-+           |#|
    |#|             |#|
    |#|             |#|
    |#|    Return   |#|
    |#|<------------|#|
    |#|             +++
    +++              |
     |               |

ie. the Return from the Call attaches to the first activation level not the second level (which ends immediately after the Call is made).

What am I doing wrong?
Thanks for any assistance

Puzzled.


hal2000

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Sorry about the garbled diagrams
« Reply #1 on: June 15, 2004, 07:44:24 pm »
Sorry about those diagrams.
Try these (hopefully these are better):

What I want:

 +-------+         +---------+
 |   :A    |          |    :B     |
 +--+---+         +----+---+
      |                        |
    +-+ Self-Call        |
    |#|--------+          |
    |#|          |           |
    |#+-+      |          |
    |#|#|<---+          |
    |#|#|                  |
    |#|#|   Call       +-+
    |#|#|----------->|#|
    |#|#|                |#|
    |#|#|                |#|
    |#|#|   Return  |#|
    |#|#|<-----------|#|
    |#+-+               +-+
    |#|                     |
   +-+                      |
     |                        |

What I get:

 +-------+         +---------+
 |   :A    |          |    :B     |
 +--+---+         +----+---+
      |                        |
    +-+ Self-Call        |
    |#|--------+          |
    |#|          |           |
    |#+-+      |          |
    |#|#|<---+          |
    |#|#|                  |
    |#|#|   Call       +-+
    |#|#|----------->|#|
    |#+-+               |#|
    |#|                    |#|
    |#|                    |#|
    |#|     Return    |#|
    |#|<--------------|#|
    |#|                   +-+
   +-+                      |
     |                        |


Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: return call attachs to incorrect activation le
« Reply #2 on: June 16, 2004, 01:08:28 am »
Hi hal2000,

don't know if it's the same problem, because your diagram is still not readable.

But have a look to the thread
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general;action=display;num=1080579180;start=0#0

May be its a similar problem.
bye
Andreas

hal2000

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
similar but involves a call to another object
« Reply #3 on: June 16, 2004, 02:50:52 pm »
Thanks for the response Andreas_G. The topic you mentioned above (May 29 '04) is very similar but not quite the same as what I would like to achieve.

Nice ASCII art by the way - I cant get mine to come out correctly

Basically the difference is that I am talking about a call made between two classes.  I would like to have the call being made from the second activation level of class A to class B.  Then the method/function of class B that was called returns a message back to class A but to the same activation level the call was made from. (i.e the second activation level)

I am using EA to represent C++ objects. I use the self-message or "internal procedure call" to represent a function call (or method call) within an object and thus the nested activation levels represent the duration of the internal function call.

So if the internal function of class A makes a call to another object (class B) and the return value is important, I would like the return message from class B to attach to the same activation level that the class A internal function is in.

The problem is that the class B return message always attaches to the primary activation level of class A instead of the higher internal function level.

Any ideas how to achieve this?
Maybe I am confusing how UML self-messages are meant to be used?

Any clarification would be appreciated
thanks


Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: return call attachs to incorrect activation le
« Reply #4 on: June 17, 2004, 12:26:26 am »
I think the problem, described by you is a problem of EA.
In my opionion it makes no sense to show it in that way like EA does it. Even I think it's a bug.

About the ASCII-Art: The trick is to write it in tyletype between tt and /tt.

Andreas
bye
Andreas

hal2000

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: return call attachs to incorrect activation le
« Reply #5 on: June 17, 2004, 03:29:23 pm »
Thanks for the help Andreas_G.  I think what would be useful is an option on the message popup menu to raise the target activation level.  I'll suggest it to SparxSystems.

Now for some ASCII art!!!
+---------+     +---------+
|   :A    |     |   :B    |
+----+----+     +----+----+
     |               |
    +++ Self-Call    |
    |#|------+       |
    |#|      |       |
    |#+-+    |       |
    |#|#|<---+       |
    |#|#|            |
    |#|#|   Call    +++
    |#|#|---------->|#|
    |#|#|           |#|
    |#|#|           |#|
    |#|#|  Return   |#|
    |#|#|<----------|#|
    |#+-+           +++
    |#|              |
    +++              |
     |               |

thomaskilian

  • Guest
Re: return call attachs to incorrect activation le
« Reply #6 on: June 17, 2004, 03:35:39 pm »
Hi HAL - you're on TV right now (German TV 2nd program). I mean you currently get switched off.

(Couldn't resist)

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: return call attachs to incorrect activation le
« Reply #7 on: June 17, 2004, 05:17:16 pm »
The use of "is Return" is a constant topic on this BB.  When I first started out with EA I did the same thing - tried to use isReturn messages to show the result of a function call.

But if you consider that the thing you are modelling using isReturn messages is not the result of the function call but an entirely separate call/signal then what EA is doing does make sense.

For example, ObjectA issues a call to ObjectB, expecting say a reference to ObjectC as the return value.  To suit your situation, lets have ObjectA issue the ObjectB call from a second level of activation.  Now let ObjectB be a factory type of thing that, before it constructs ObjectC, issues a call back to ObjectA to get the specific type of ObjectC to create.  This message is a (sort of) callback to ObjectA - not a return value (or it may be implemented as a callback).  This to me represents yet another activation level of ObjectA, sepearate entirely from the base level or the selfcall message.

Unfortunately, neither the UML nor EA have a way to clearly show this.  EA shows the callback hitting the base activation level.

The activation level is related to the "source" end of the message - not the target. Each target end of a message is in fact a new activation of the targeted object.  This makes sense. (Thus, UML shows the "stepped up" lifeline in the case of a self call.)  If the called (target) object issues further calls at this level then the source lifeline is extended. OK, this makes sense.  So is the lifeline if the oringinal caller - supposedly to indicate that the activation does not terminate until the called object lifeline terminates.

However,  (he said) the situation would more be more adequately shown as a "fanout" rather than an extended lifeline on the orginal caller which we intuitively interpret as the original caller doing other things - rather than being in a state of suspended animation until the focus of control is returned from the called object.

In short, firstly the result of a function call is returned along the same diagram line as the call not as a new message. Secondly, UML sequence diagram lifeline boxes do not provide a linear representation of "time" as we intuitively think of it.  Finally, think of every target end of a message arrow as representing a new activation.

So, what then is the use of the "isReturn" flag on a message.  It indicates that the call is the end of the current activation level on the source. It appears to only be of use if "Suppress Focus of Control" is turned on.

hth
Bruce

« Last Edit: June 17, 2004, 07:01:26 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

hal2000

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
thanks
« Reply #8 on: June 17, 2004, 09:31:20 pm »
Thanks Bruce

Visualing the return message along the same line as the original call makes the uml sequence diagrams "activation lifelines" a lot easier to understand.

I appreciate the help.

Quote
HAL2000: Say, Dave... The quick brown fox jumped over the fat lazy dog ... The square root of pi is 1.7724538090 ... log e to the base ten is 0.4342944 ... the square root of ten is 3.16227766 ... I am HAL 9000 computer. I became operational at the HAL plant in Urbana, Illinois, on January 12th, 1991. My first instructor was Mr. Arkany. He taught me to sing a song... it goes like this... "Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you..."


sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: return call attachs to incorrect activation le
« Reply #9 on: June 17, 2004, 09:43:19 pm »
Here's another trick.

Print out the diagram and cover up all but one object.  (you may have to jiggle the message labels left and right a bit).

Now - does the sequence make sense from the point of view of that object?

Bruce

« Last Edit: June 17, 2004, 09:43:41 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.