Home » Modeling » OCL » Are OCL derivation constraints a test ?
Are OCL derivation constraints a test ? [message #13597] 
Tue, 20 March 2007 20:46 
Eclipse User 



Originally posted by: maiera.de.ibm.com
I am trying ot understand the semantic difference between invariant
constraints and derivation constraints.
It is clear to me what invariant constraints are, they purely test a
condition and are free of any sideeffects.
Derivation constraints could be understood in two ways:
1. As a test whether the property has the specified value at any time,
i.e. also completely sideeffect free.
2. As a specification on how to compute the value of the property at any
time. I.e. an OCL engine could compute the property value at runtime.
This sounds interesting, but seems to be in conflict with the general
statement that OCL is sideeffect free.
I tend to go for 1., but on the other hand that leaves derivatoin
constraints to be only a special case of invariants, so why ar ethey
needed at all.
> Is there a simple answer how to understand derivation constraints ?
Andy



Re: Are OCL derivation constraints a test ? [message #13648 is a reply to message #13597] 
Wed, 21 March 2007 15:58 
Eclipse User 



Originally posted by: cdamus.ca.ibm.com
Hi, Andy,
The answer, I think, is a blend of #1 and #2. The derivation constraint
specifies what the value of a derived property is, by providing an
expression whose value is the expected value of the property. In this
respect, it "constrains" the derived property.
At runtime, an implementation can make this (implicit) equality constraint
always trivially satisfied by actually evaluating the OCL expression. The
OCL expression, as such, is still sideeffectfree. It does not change any
state of the object; remember that the property is, by definition, a
computed value.
Does that help?
Christian
Andreas Maier wrote:
> I am trying ot understand the semantic difference between invariant
> constraints and derivation constraints.
>
> It is clear to me what invariant constraints are, they purely test a
> condition and are free of any sideeffects.
>
> Derivation constraints could be understood in two ways:
>
> 1. As a test whether the property has the specified value at any time,
> i.e. also completely sideeffect free.
>
> 2. As a specification on how to compute the value of the property at any
> time. I.e. an OCL engine could compute the property value at runtime.
> This sounds interesting, but seems to be in conflict with the general
> statement that OCL is sideeffect free.
>
> I tend to go for 1., but on the other hand that leaves derivatoin
> constraints to be only a special case of invariants, so why ar ethey
> needed at all.
>
> > Is there a simple answer how to understand derivation constraints ?
>
> Andy



Re: Are OCL derivation constraints a test ? [message #13692 is a reply to message #13648] 
Thu, 22 March 2007 07:22 
Eclipse User 



Originally posted by: maiera.de.ibm.com
Christian,
that helps!
> The OCL expression, as such, is still sideeffectfree.
That was the key for me to address my confusion about it.
Thanks!
Andy
Christian W. Damus wrote:
> Hi, Andy,
>
> The answer, I think, is a blend of #1 and #2. The derivation constraint
> specifies what the value of a derived property is, by providing an
> expression whose value is the expected value of the property. In this
> respect, it "constrains" the derived property.
>
> At runtime, an implementation can make this (implicit) equality constraint
> always trivially satisfied by actually evaluating the OCL expression. The
> OCL expression, as such, is still sideeffectfree. It does not change any
> state of the object; remember that the property is, by definition, a
> computed value.
>
> Does that help?
>
> Christian
>
>
> Andreas Maier wrote:
>
>> I am trying ot understand the semantic difference between invariant
>> constraints and derivation constraints.
>>
>> It is clear to me what invariant constraints are, they purely test a
>> condition and are free of any sideeffects.
>>
>> Derivation constraints could be understood in two ways:
>>
>> 1. As a test whether the property has the specified value at any time,
>> i.e. also completely sideeffect free.
>>
>> 2. As a specification on how to compute the value of the property at any
>> time. I.e. an OCL engine could compute the property value at runtime.
>> This sounds interesting, but seems to be in conflict with the general
>> statement that OCL is sideeffect free.
>>
>> I tend to go for 1., but on the other hand that leaves derivatoin
>> constraints to be only a special case of invariants, so why ar ethey
>> needed at all.
>>
>> > Is there a simple answer how to understand derivation constraints ?
>>
>> Andy
>



Goto Forum:
Current Time: Tue Jul 26 18:04:52 GMT 2016
Powered by FUDForum. Page generated in 0.02283 seconds
