Re: LSP Was: Mixing OO and DB
Date: Fri, 22 Feb 2008 09:37:45 +0000
Daniel T. wrote:
> Robert Martin <unclebob_at_objectmentor.com> wrote:
>>On 2008-02-20 09:16:17 -0600, S Perryman <q_at_q.com> said:
RM>S is any and every subtype of T. S' is in the class of S. RM>Remember, Liskov's rule was an attempt to define what S was. In RM>essense she said that subtypes are those things that are RM>substitutable. SP>No. SP>Liskov and Wing define their subtype predicate in a specific way,SP>using a substitutability predicate. The latter predicate they SP>also define very precisely.
>>Maybe I'm missing something. The principle has been around for a
You're "missing" about 10 years of subsequent work by Liskov and Wing on subtypes.
>> The old quote from the May, 1988 Sigplan Notices was:
>>"What is wanted here is something like the following substitution
>>property: If for each object o1 of type S there is an object o2 of
>>type T such that for all programs P deŽned in terms of T, the
>>behavior of P is unchanged when o1 is substituted for o2 then S is
>>a subtype of T."
>>Are you referring to something else?
> I haven't followed the other thread so I'm not sure how relevant my > comments may be... Liskov did provide a contract system (as in DBC) as a > metric to determine substitutability, could that be the > "substitutability predicate"
It is indeed.
Behavioral Subtyping Using Invariants and Constraints (1999) , Liskov, Wing.
Section 5 is where the definition of subtype is made. Section 5.2 (page 10) is where the subtype relation is formally defined.
As the definition makes *no reference to any program* that may be using some types S/T, the claim about Liskov/Wing subtyping being dependent on a given program is in fact fallacy.
And for practical demonstration, I can take the apocrypthal Circle/Ellipse problem, and show that Circle is not a Liskov/Wing subtype of Ellipse without ever needing to see any program that may be using Circle or Ellipse types.
> that Mr. Perryman is talking about?
Whats' with the "Mr" ?? :-)
Steven Perryman Received on Fri Feb 22 2008 - 03:37:45 CST