Re: Clean Object Class Design -- Circle/Ellipse

From: Marc Gluch <marc.gluch_at_mindtap.com>
Date: Tue, 07 Aug 2001 04:54:23 GMT
Message-ID: <3b6f5ed3.2791005513_at_news.grpvine1.tx.home.com>


On Mon, 6 Aug 2001 09:43:22 +0300, "Cagdas Ozgenc" <co19_at_cornell.edu> wrote:

>
>> In "Type Inheritance: Is a Circle an Ellipse?" on www.dbdebunk.com
>> Date insists:
>> "As already indicated, it's my position that a circle categorically is
>> an ellipse in the real world -- to be specific, it's an ellipse in
>> which the two semiaxes coincide in the radius (equivalently, it's an
>> ellipse for which a=b). In my opinion, therefore, any "model" of
>> inheritance in which type CIRCLE is not considered to be a subtype of
>> type ELLIPSE can hardly be said to be a good model of reality."
>>
>> Is that a MAY (allow) or a MUST(require)?
>> Hint; what does *categorically* mean?
>
>The similar discussion was on "Is square a rectangle?"
I know.

I followed that thread for a while, but decided that the question "can T as superset of S be used as a basis for constructing a supertype" would benefit from analysis in a context where there is no distracting arguments about what operations are legitimate for a given type. I picked Integers and Reals hoping that everyone understood these (including +, *, and implicitly =, <) well enough to focus on the core of the question.

> My conclusion was it totally depends on how you model the class hierarchy.
Sorry, but this conclusion doesn't have much prescriptive value.

The (interesting) question is not "can you model it this way or another" , but rather "what is the utility of each model". Btw, consistency is a prerequisite for utility.

Attempts to define types as domains (sets) may yield satisfactory results in the database world (duh), but they break down when extended to functional and algebraic types.

The root cause (IMO) is that they focus on the types' extent (elements of the sets) rather than intent (specifications). It is the intent that describes the utility of each model.

The only "fool-proof" way of deciding if A is a subtype of B, that I know, is to treat A and B as formal theories.

The first questions to consider would be: Are A and B consistent?
Does one make more assumptions (postulate more axioms) than the other?

Finally the utility question; can elements of A be substituted for elements of B without breaking the theory of B?  If not, why bother - you can specify A from scratch without breaking B.

Also, note that there is no single right way (whether it's Date's way or not) ) to model the "real world".
Both set theory and lambda calculus can be used as foundations for mathematics, but each approach will make different things easier (or harder) to prove.

Marc Gluch
Mindtap Inc. Received on Tue Aug 07 2001 - 06:54:23 CEST

Original text of this message