Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Multiple return parameters
Multiple return parameters [message #477107] Fri, 21 March 2008 15:04 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hey,

anyone knows if relaxing the 'only one return parameter' constraint has
been discussed? I don't see that this should be a constraint.

Felix
Re: Multiple return parameters [message #477108 is a reply to message #477107] Fri, 21 March 2008 15:32 Go to previous messageGo to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hi Felix,

I think if you look at the Parameter type in the superstructure
specification, you'll see something called ParameterDirectionKind as an
attribute. This "indicates whether a parameter is being sent into or out
of a behavioral element". I guess though you can only have 0 or 1 return
result of an operation (if you look at Operation in the spec).


Is this what you are looking for?
Andrew.

Ar 21/03/2008 15:04, Scríobh Felix Dorner:
> Hey,
>
> anyone knows if relaxing the 'only one return parameter' constraint has
> been discussed? I don't see that this should be a constraint.
>
> Felix
Re: Multiple return parameters [message #477109 is a reply to message #477108] Fri, 21 March 2008 15:36 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Andrew Carton wrote:
> Hi Felix,
>
> I think if you look at the Parameter type in the superstructure
> specification, you'll see something called ParameterDirectionKind as an
> attribute. This "indicates whether a parameter is being sent into or out
> of a behavioral element". I guess though you can only have 0 or 1 return
> result of an operation (if you look at Operation in the spec).

That's exactly what I referred to. I don't see a need why one should not
be able to have more than one parameter with direction "return". To me
this is overconstrained...

Felix
Re: Multiple return parameters [message #477110 is a reply to message #477109] Fri, 21 March 2008 19:10 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Why would you need more than one return parameter? Do you know you can
have multiple OUT parameters, which can serve the same purpose?

Also, your return parameter can have a multiplicity greater than one, if
you need to return multiple results of the same type.

Cheers,

Rafael

Felix Dorner wrote:
> Andrew Carton wrote:
>> Hi Felix,
>>
>> I think if you look at the Parameter type in the superstructure
>> specification, you'll see something called ParameterDirectionKind as
>> an attribute. This "indicates whether a parameter is being sent into
>> or out of a behavioral element". I guess though you can only have 0 or
>> 1 return result of an operation (if you look at Operation in the spec).
>
> That's exactly what I referred to. I don't see a need why one should not
> be able to have more than one parameter with direction "return". To me
> this is overconstrained...
>
> Felix
Re: Multiple return parameters [message #477111 is a reply to message #477110] Sat, 22 March 2008 08:22 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hey Rafael,

> Why would you need more than one return parameter? Do you know you can
> have multiple OUT parameters, which can serve the same purpose?

For the same reason I'd like more than one out parameter...
I don't understand the difference between "RETURN" and "OUT".

out: Indicates that parameter values are passed from a behavioral
element out to the caller.

return: Indicates that parameter values are passed as return values from
a behavioral element back to the caller.


Where is the _semantic_ difference between those two.. If there is none,
, one should be dropped.

Felix
Re: Multiple return parameters [message #477113 is a reply to message #477111] Sat, 22 March 2008 09:33 Go to previous messageGo to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hey,

A BehavioralFeature can contain ownedParameters. I think there may be
variations in the way each concrete classes that realise the
BehavioralFeature use Parameters. For example, the BehavioralFeature can
have multiple ownedParameters. Operation redefines (specialises) its
ownedParameters. Although I can't much else except Reception
specialising a BehavioralFeature...

I think the combination of the ParameterDirectionKind and the
ParameterEffectKind may make it clearer what the parameter does when it
is passed to a BehavioralFeature. (A ParameterEffectKind is an
enumeration that indicates the effect of a behavior on values passed in
or out of its parameters (create, read, update, delete).

There are also constraints on these:
"Only in and inout parameters may have a delete effect. Only out, inout,
and return parameters may have a create effect."

Also:
"The effect of a parameter is a declaration of the modeler’s intent, and
does not have execution semantics. The modeler must ensure that the
owner of the parameter has the stated effect."

So I reckon it is probably up to you how you want to implement the
behaviour, as long as you abide by the constraints of the metamodel.

I find it a bit confusing also. I think you also have to honour the fact
that programming languages are varied in this regard too. Some
programming languages support pass by value or pass be reference and
some do both. Perhaps the UML standard is simply trying to appease the
variations of programming languages? I'm not sure though! :)

Perhaps "return" is when the behavior has finished executing while an
"out" can indicate a parameter during the execution?

Andrew.

Felix Dorner wrote:
> Hey Rafael,
>
>> Why would you need more than one return parameter? Do you know you can
>> have multiple OUT parameters, which can serve the same purpose?
>
> For the same reason I'd like more than one out parameter...
> I don't understand the difference between "RETURN" and "OUT".
>
> out: Indicates that parameter values are passed from a behavioral
> element out to the caller.
>
> return: Indicates that parameter values are passed as return values from
> a behavioral element back to the caller.
>
>
> Where is the _semantic_ difference between those two.. If there is none,
> , one should be dropped.
>
> Felix
Re: Multiple return parameters [message #477114 is a reply to message #477111] Sat, 22 March 2008 18:38 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Programming languages usually have return values as the most convenient
way of extracting a value from an operation invocation, although many
have also parameter passing by reference (which is equivalent to
in-out). RPC/distributed object technologies (such as CORBA IDL and
SOAP) often provide output parameters, as invocations are expensive and
there is need to get as many results back as possible.

The difference between out and return parameters is more a matter of
syntax than semantics. UML provides a mix of features commonly found on
target technologies and thus provides both. You will see this manifested
in many places of the specification, where there are two or more ways of
achieving the same thing.

> If there is none, one should be dropped.

Hmm... this is definitely *not* the UML way...

Cheers,

Rafael

Felix Dorner wrote:
> Hey Rafael,
>
>> Why would you need more than one return parameter? Do you know you can
>> have multiple OUT parameters, which can serve the same purpose?
>
> For the same reason I'd like more than one out parameter...
> I don't understand the difference between "RETURN" and "OUT".
>
> out: Indicates that parameter values are passed from a behavioral
> element out to the caller.
>
> return: Indicates that parameter values are passed as return values from
> a behavioral element back to the caller.
>
>
> Where is the _semantic_ difference between those two.. If there is none,
> , one should be dropped.
>
> Felix
Re: Multiple return parameters [message #477117 is a reply to message #477113] Mon, 24 March 2008 09:27 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Andrew Carton wrote:

>Perhaps the UML standard is simply trying to appease the
> variations of programming languages? I'm not sure though! :)

There's languages that support multiple return values. More even, there
are languages that support tuples, this could be nicely mapped by
allowing multiple return values in UML.

> Perhaps "return" is when the behavior has finished executing while an
> "out" can indicate a parameter during the execution?

I was also thinking about this.

Thanks for the discussion,
Felix
Re: Multiple return parameters [message #626244 is a reply to message #477107] Fri, 21 March 2008 15:32 Go to previous message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hi Felix,

I think if you look at the Parameter type in the superstructure
specification, you'll see something called ParameterDirectionKind as an
attribute. This "indicates whether a parameter is being sent into or out
of a behavioral element". I guess though you can only have 0 or 1 return
result of an operation (if you look at Operation in the spec).


Is this what you are looking for?
Andrew.

Ar 21/03/2008 15:04, Scríobh Felix Dorner:
> Hey,
>
> anyone knows if relaxing the 'only one return parameter' constraint has
> been discussed? I don't see that this should be a constraint.
>
> Felix
Re: Multiple return parameters [message #626245 is a reply to message #477108] Fri, 21 March 2008 15:36 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Andrew Carton wrote:
> Hi Felix,
>
> I think if you look at the Parameter type in the superstructure
> specification, you'll see something called ParameterDirectionKind as an
> attribute. This "indicates whether a parameter is being sent into or out
> of a behavioral element". I guess though you can only have 0 or 1 return
> result of an operation (if you look at Operation in the spec).

That's exactly what I referred to. I don't see a need why one should not
be able to have more than one parameter with direction "return". To me
this is overconstrained...

Felix
Re: Multiple return parameters [message #626246 is a reply to message #477109] Fri, 21 March 2008 19:10 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Why would you need more than one return parameter? Do you know you can
have multiple OUT parameters, which can serve the same purpose?

Also, your return parameter can have a multiplicity greater than one, if
you need to return multiple results of the same type.

Cheers,

Rafael

Felix Dorner wrote:
> Andrew Carton wrote:
>> Hi Felix,
>>
>> I think if you look at the Parameter type in the superstructure
>> specification, you'll see something called ParameterDirectionKind as
>> an attribute. This "indicates whether a parameter is being sent into
>> or out of a behavioral element". I guess though you can only have 0 or
>> 1 return result of an operation (if you look at Operation in the spec).
>
> That's exactly what I referred to. I don't see a need why one should not
> be able to have more than one parameter with direction "return". To me
> this is overconstrained...
>
> Felix
Re: Multiple return parameters [message #626247 is a reply to message #477110] Sat, 22 March 2008 08:22 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hey Rafael,

> Why would you need more than one return parameter? Do you know you can
> have multiple OUT parameters, which can serve the same purpose?

For the same reason I'd like more than one out parameter...
I don't understand the difference between "RETURN" and "OUT".

out: Indicates that parameter values are passed from a behavioral
element out to the caller.

return: Indicates that parameter values are passed as return values from
a behavioral element back to the caller.


Where is the _semantic_ difference between those two.. If there is none,
, one should be dropped.

Felix
Re: Multiple return parameters [message #626248 is a reply to message #477111] Sat, 22 March 2008 09:33 Go to previous message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hey,

A BehavioralFeature can contain ownedParameters. I think there may be
variations in the way each concrete classes that realise the
BehavioralFeature use Parameters. For example, the BehavioralFeature can
have multiple ownedParameters. Operation redefines (specialises) its
ownedParameters. Although I can't much else except Reception
specialising a BehavioralFeature...

I think the combination of the ParameterDirectionKind and the
ParameterEffectKind may make it clearer what the parameter does when it
is passed to a BehavioralFeature. (A ParameterEffectKind is an
enumeration that indicates the effect of a behavior on values passed in
or out of its parameters (create, read, update, delete).

There are also constraints on these:
"Only in and inout parameters may have a delete effect. Only out, inout,
and return parameters may have a create effect."

Also:
"The effect of a parameter is a declaration of the modeler’s intent, and
does not have execution semantics. The modeler must ensure that the
owner of the parameter has the stated effect."

So I reckon it is probably up to you how you want to implement the
behaviour, as long as you abide by the constraints of the metamodel.

I find it a bit confusing also. I think you also have to honour the fact
that programming languages are varied in this regard too. Some
programming languages support pass by value or pass be reference and
some do both. Perhaps the UML standard is simply trying to appease the
variations of programming languages? I'm not sure though! :)

Perhaps "return" is when the behavior has finished executing while an
"out" can indicate a parameter during the execution?

Andrew.

Felix Dorner wrote:
> Hey Rafael,
>
>> Why would you need more than one return parameter? Do you know you can
>> have multiple OUT parameters, which can serve the same purpose?
>
> For the same reason I'd like more than one out parameter...
> I don't understand the difference between "RETURN" and "OUT".
>
> out: Indicates that parameter values are passed from a behavioral
> element out to the caller.
>
> return: Indicates that parameter values are passed as return values from
> a behavioral element back to the caller.
>
>
> Where is the _semantic_ difference between those two.. If there is none,
> , one should be dropped.
>
> Felix
Re: Multiple return parameters [message #626249 is a reply to message #477111] Sat, 22 March 2008 18:38 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Programming languages usually have return values as the most convenient
way of extracting a value from an operation invocation, although many
have also parameter passing by reference (which is equivalent to
in-out). RPC/distributed object technologies (such as CORBA IDL and
SOAP) often provide output parameters, as invocations are expensive and
there is need to get as many results back as possible.

The difference between out and return parameters is more a matter of
syntax than semantics. UML provides a mix of features commonly found on
target technologies and thus provides both. You will see this manifested
in many places of the specification, where there are two or more ways of
achieving the same thing.

> If there is none, one should be dropped.

Hmm... this is definitely *not* the UML way...

Cheers,

Rafael

Felix Dorner wrote:
> Hey Rafael,
>
>> Why would you need more than one return parameter? Do you know you can
>> have multiple OUT parameters, which can serve the same purpose?
>
> For the same reason I'd like more than one out parameter...
> I don't understand the difference between "RETURN" and "OUT".
>
> out: Indicates that parameter values are passed from a behavioral
> element out to the caller.
>
> return: Indicates that parameter values are passed as return values from
> a behavioral element back to the caller.
>
>
> Where is the _semantic_ difference between those two.. If there is none,
> , one should be dropped.
>
> Felix
Re: Multiple return parameters [message #626252 is a reply to message #477113] Mon, 24 March 2008 09:27 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Andrew Carton wrote:

>Perhaps the UML standard is simply trying to appease the
> variations of programming languages? I'm not sure though! :)

There's languages that support multiple return values. More even, there
are languages that support tuples, this could be nicely mapped by
allowing multiple return values in UML.

> Perhaps "return" is when the behavior has finished executing while an
> "out" can indicate a parameter during the execution?

I was also thinking about this.

Thanks for the discussion,
Felix
Previous Topic:How to add input pins or output pins to a CallOperationAction or CallBehaviorAction?
Next Topic:Re: validate applied to umleditor
Goto Forum:
  


Current Time: Fri Mar 29 05:30:23 GMT 2024

Powered by FUDForum. Page generated in 0.03870 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top