Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Are OCL derivation constraints a test ?
Are OCL derivation constraints a test ? [message #13597] Tue, 20 March 2007 20:46 Go to next message
Eclipse UserFriend
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 side-effects.

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 side-effect 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 run-time.
This sounds interesting, but seems to be in conflict with the general
statement that OCL is side-effect 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 Go to previous messageGo to next message
Eclipse UserFriend
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 run-time, an implementation can make this (implicit) equality constraint
always trivially satisfied by actually evaluating the OCL expression. The
OCL expression, as such, is still side-effect-free. 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 side-effects.
>
> 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 side-effect 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 run-time.
> This sounds interesting, but seems to be in conflict with the general
> statement that OCL is side-effect 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 Go to previous message
Eclipse UserFriend
Originally posted by: maiera.de.ibm.com

Christian,
that helps!

> The OCL expression, as such, is still side-effect-free.

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 run-time, an implementation can make this (implicit) equality constraint
> always trivially satisfied by actually evaluating the OCL expression. The
> OCL expression, as such, is still side-effect-free. 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 side-effects.
>>
>> 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 side-effect 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 run-time.
>> This sounds interesting, but seems to be in conflict with the general
>> statement that OCL is side-effect 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
>
Previous Topic:Null exception in constraints on EnumerationLiteral
Next Topic:"self" context and context defined by "context" keyword
Goto Forum:
  


Current Time: Fri Nov 28 00:41:15 GMT 2014

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

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