From: Rick Elbers on
Dmitry,

Sorry I missed the whole discussion, but from what you state here
it makes me question what the discussion about rectangles and
squares used for "behavior". If you say:

> < Squares> is a subset <Rectangles>,
>
>but
>
> <Squares + the behavior of> is not a subset of
> <Rectangles + the behavior of>

Can you please give a valid "behavior" for which this proposition is
valid ?

Regards,

Rick


Op Tue, 8 Aug 2006 20:15:05 +0200 schreef "Dmitry A. Kazakov"
<mailbox(a)dmitry-kazakov.de>:

>On Tue, 08 Aug 2006 16:45:16 GMT, H. S. Lahman wrote:
>
>> BTW, inheritance and LSP apply to both knowledge and behavior
>> responsibility properties. A lot of LSP debates about behaviors go in
>> circles because nobody has noticed that LSP was violated because the
>> knowledge attributes where redefined.
>
>True.
>
>> In a classic recent example here
>> the debate centered around deriving Rectangle behaviors from Square
>> behaviors. The real problem was that Square was defined with a
>> sideLength knowledge attribute while Rectangle was defined with
>> majorSideLength and minorSideLength -- apples & oranges.
>
>It is not apples and oranges. It is squares and rectangles. (:-))
>
>SideLength is a direct reflection of a trivial geometrical fact (theorem)
>about squares. This theorem does not hold for rectangles. End of story.
>

It doesnt have to because I wouldnt consider SideLength a behavior.
Its a property or knowledge attribute or something else which I
consider and implementation aspect of this particular kind of Shape..

>The set of true propositions about squares is not a subset of the set of
>true propositions about rectangles. In other words:
>
> < Squares> is a subset <Rectangles>,
>
>but
>
> <Squares + the behavior of> is not a subset of
> <Rectangles + the behavior of>
>
>Most of LSP debates are about these apples and oranges. To believe in LSP
>is as silly as to do in that Shakespeare could write in Basic English.
>Isn't it a subset of English?

From: Dmitry A. Kazakov on
On Tue, 08 Aug 2006 22:51:43 +0200, Rick Elbers wrote:

> Sorry I missed the whole discussion, but from what you state here
> it makes me question what the discussion about rectangles and
> squares used for "behavior". If you say:
>
>> < Squares> is a subset <Rectangles>,
>>
>>but
>>
>> <Squares + the behavior of> is not a subset of
>> <Rectangles + the behavior of>
>
> Can you please give a valid "behavior" for which this proposition is
> valid ?

Which proposition? If you mean "is not a subset", then this one:

forall x in <Squares> height(x) = width(x)

is a member of the first set, and not a member of the second.

Behaviour in my free interpretation of Liskov's definition is the set of
true (maybe, provable) propositions involving the type. [ OK, we should
probably add "public" or "contracted", to exclude implementation details
from sizeof() to the temperature of the CPU. ]

Substitutability is when <Squares> can be substituted for <Rectangles> in
all such propositions in an arbitrary number of occurrences, keeping the
propositions true.

Though substitutability is weaker than subsetting of elements and
propositions about them, as the example above shows. But it is far stronger
than subsetting of only elements, or existence of an injective mapping
between element sets (a natural generalization of otherwise unusable
subsetting).

Basically, subsetting of elements is worth of nothing. Important is what
one could do with elements (behavior). The latter is not a function of the
former. That's why we have type systems and OOA/D. Moreover, because
elements are abstracted through behavior, they are irrelevant altogether.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: S Perryman on
"Rick Elbers" <rick(a)elbers.org> wrote in message
news:b1uhd2t578u1sbo1fkog4uhehvpv4uj3mi(a)4ax.com...

> Sorry I missed the whole discussion, but from what you state here
> it makes me question what the discussion about rectangles and
> squares used for "behavior". If you say:

>> < Squares> is a subset <Rectangles>,

>>but

>> <Squares + the behavior of> is not a subset of
>> <Rectangles + the behavior of>
>
> Can you please give a valid "behavior" for which this proposition is valid
> ?

Search comp.object.
Examples abound of valid behavioural definitions of Square/Rectangle which
result in substitutability conflicts.

Or did you mean to ask for definitions whereby <Squares + behaviour> is a
subset of <Rectangles + behaviour> ... ??


Regards,
Steven Perryman


From: S Perryman on
"Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> wrote in message
news:1b70cy0fhj7vy$.hkddcs8g9727$.dlg(a)40tude.net...

> Behaviour in my free interpretation of Liskov's definition is the set of
> true (maybe, provable) propositions involving the type. [ OK, we should
> probably add "public" or "contracted", to exclude implementation details
> from sizeof() to the temperature of the CPU. ]

Nope.
Implementation details have propositions too (abs function, REP invariants
etc) .


> Substitutability is when <Squares> can be substituted for <Rectangles> in
> all such propositions in an arbitrary number of occurrences, keeping the
> propositions true.

Substitutability in all contexts is the Liskov/Wing subtype definition.
Better IMHO to talk of substitutability as for one given context C, and two
types T1 and T2.


> Though substitutability is weaker than subsetting of elements and
> propositions about them, as the example above shows. But it is far
> stronger
> than subsetting of only elements, or existence of an injective mapping
> between element sets (a natural generalization of otherwise unusable
> subsetting).

If two entities E1 and E2 have a mathematical subset relationship between
them,
then a s/w representation of E1 and E2 are likely to have a substitutability
conflict (Wegner and Zdonik, 1988) .

It is the subset relationship that is the prime cause of substitutability
conflicts.

Which amuses me when you see people claiming that in s/w, inheritance is
about
defining subsets (apart from the fact that inheritance as it happens
biologically
does no such thing either) ...


Regards,
Dmitry A. Kazakov


From: Dmitry A. Kazakov on
On Wed, 9 Aug 2006 09:11:22 +0100, S Perryman wrote:

> "Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> wrote in message
> news:1b70cy0fhj7vy$.hkddcs8g9727$.dlg(a)40tude.net...
>
>> Behaviour in my free interpretation of Liskov's definition is the set of
>> true (maybe, provable) propositions involving the type. [ OK, we should
>> probably add "public" or "contracted", to exclude implementation details
>> from sizeof() to the temperature of the CPU. ]
>
> Nope.
> Implementation details have propositions too (abs function, REP invariants
> etc) .

Sure. I only wished to stress that we cannot talk about all propositions
indiscriminately. When you below talk about contexts, then "contracted" is
just a context, still too wide in many cases.

>> Substitutability is when <Squares> can be substituted for <Rectangles> in
>> all such propositions in an arbitrary number of occurrences, keeping the
>> propositions true.
>
> Substitutability in all contexts is the Liskov/Wing subtype definition.
> Better IMHO to talk of substitutability as for one given context C, and two
> types T1 and T2.

Yes, this is the only way - to constrain the sets of propositions. From the
type system perspective, it would be desirable to be able to describe such
contexts making it possible for the compiler to determine when we are in a
context of substitutability. It is difficult to find for this any other
place than type declarations. So in the end it is still the same
Liskov/Wing's idea of mapping substitutability to types, but approached
from the other end, in a more pragmatic manner.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de