|
|
|
|
|
Re: Multiple return parameters [message #477113 is a reply to message #477111] |
Sat, 22 March 2008 09:33 |
Andrew Carton 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 |
Rafael Chaves 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 #626248 is a reply to message #477111] |
Sat, 22 March 2008 09:33 |
Andrew Carton 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 |
Rafael Chaves 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.05337 seconds