Re: LSP Was: Mixing OO and DB

From: Stefan Ram <ram_at_zedat.fu-berlin.de>
Date: 23 Feb 2008 19:45:02 GMT
Message-ID: <subtype-20080223204217_at_ram.dialup.fu-berlin.de>


ram_at_zedat.fu-berlin.de (Stefan Ram) writes:
>I would prefer the following criterion (in my own wording):
>»B is a subtype of P, when it fulfill P's specification.«

  I would like to add a rewording of this, which will allow me   to apply the /same/ criterion to both primitive types and   operational types:

      »An entity of a subtype fulfills all constraints fulfilled
      by entities of the supertype of this subtype. An entity of a
      /proper/ subtype also fulfills additional constraints.«

  Application to primitive types (sets of values):

      {0,1} is a proper subtype of {0,1,2,3}.
      The entities of the supertype fulfill the constraint »0 <= x < 4«.
      The entites of the subtype fulfill this and the additional
      constraint »x < 2«, so it is a proper subtype.

  Application to operational types (objects):

      In Java, the class of an object of the class String is a
      subtype of the class of an object of the class Object,
      because it fulfills the constraints for objects of the
      class Object (like the rules for the operation
      »hashCode«). It is a /proper/ subtype because it also
      fulfills additional constraints (like the rules for the
      operation »length«).
Received on Sat Feb 23 2008 - 20:45:02 CET

Original text of this message