Re: LSP Was: Mixing OO and DB

From: andrew queisser <andrew.queisser_at_hp.com>
Date: Thu, 21 Feb 2008 13:10:00 -0800
Message-ID: <fpkpb9$ujf$1_at_usenet01.boi.hp.com>


"Robert Martin" <unclebob_at_objectmentor.com> wrote in message news:2008022112164944303-unclebob_at_objectmentorcom...
>>
>> Not true.
>> The Liskov/Wing definition of substitutability and subtype is
>> mathematically definable. Therefore for any given T1, T2, it may be
>> possible to prove the relationship (subtype or not +/- when) without
>> regard
>> to P.
>
> Given the quote above, I'm not sure how you can come to that conclusion.
> Even if you use the more recent 1999 quote:
>
> "Let q(x) be a property provable about objects x of type T. Then q(y)
> should be true for objects y of type S where S is a subtype of T."
>
> We still wind up with subtyping being defined based on q, where q is *a
> property*, not all properties, which means that S is only a subtype for
> those programs that use the q properties. Any program that uses
> properties of S that don't meet the criteria do not view S as a subtype.
>
>

Right, and most people fighting over LSP don't understand this. If you define equate "type" with "public interface" and "subtype" with "inheritance" you won't have any fun at all.

I remember grown men fighting over the program

print v.type.name

which supposedly breaks LSP for any imaginable type/subtype relationship in a language that has reflection.

Andrew Received on Thu Feb 21 2008 - 22:10:00 CET

Original text of this message