Re: Clean Object Class Design -- Circle/Ellipse

From: Martijn Meijering <mmeijeri_at_xs4all.nl>
Date: 4 Aug 2001 21:43:19 GMT
Message-ID: <90F3FDB73mmeijerixs4allnl_at_194.109.6.74>


bbadour_at_golden.net (Bob Badour) wrote in <N3Ya7.219$kk6.18971688_at_radon.golden.net>:
>>Is it still true that "any model of inheritance in which type
>>Integer is not considered to be a subtype of type Real
>>can hardly be said to be a good model of reality" ?
>
>Yes. It is still true. All of the operators on Real to yield Real apply
>equally when one substitutes an Integer for the Real operand, and all of
>the operators on Real to yield Integer apply equally when one
>substitutes an Integer for the Real operand.

Closure under operations is only part of the mathematical definition of type. A type is defined not only by an underlying set and a set of operations, but also by a set of axioms.

Are the integers a subtype of the reals? It depends on which axioms you are considering. If you are looking at them as a plain set, monoid or group, the answer is yes. If you are looking at them as a field or a real vector space, the answer is no.

Now which definition of type is the "correct model of reality"? Modeling reality being the province of science, let us recall the role of models in science. Models are considered good if they are useful. Relevant qualities include accuracy of predictions, range of applicability and simplicity.

The present discussions has not specified the context. Without the context the question "are the integers a subtype of the reals" is ill-posed.

>>To put bluntly, " Type Inheritance: Is a Circle an Ellipse?"
>>documents lack of understanding of types (and OO),
>>and the usefulness of Date's inheritance model approaches zero.
>
>Your statement is not only blunt: It is also an extraordinary statement
>requiring extraordinary proof, which you have failed to provide, and to
>put it bluntly, it is also incorrect.

Actually, it's neither extraordinary nor incorrect. It all depends on more precise definitions of type and OO.

Martijn Received on Sat Aug 04 2001 - 23:43:19 CEST

Original text of this message