Re: Clean Object Class Design -- Circle/Ellipse

From: <D_at_B.A>
Date: Fri, 20 Jul 2001 00:16:48 GMT
Message-ID: <QLK57.197$ar1.2095_at_www.newsranger.com>


In article <EZG57.172$o07.44117090_at_radon.golden.net>, Bob Badour says...
>
>>I must admit that I judged the article upon it's ability to answer a set of
>>questions I have in mind, which is not quite fair. Here it is:
>>
>>1. Is the case Square/Rectangle really similar to Circle/Ellipse?
>
>Yes.

Then, why does evaluating Ellipse perimeter requires elliptic integral knowledge but is trivial for Rectangle?

>>i. What methods/operations in Rectangle signature would make it different
 from
>>Ellipse?
>
>A rectangle, like any quadrilateral, has four vertices. A rectangle, like
>any polygon, has a property that describes the number of sides.

Why can't we declare that ellipse has infinitely many vertices/sides?

>>If they are identical from signature perspective, then, maybe,
>>Rectangle and Ellipse are just 2 different implementations of same type?
>
>Why would they be identical?

Both could be defined as invariants of cyclic subgroup of octic (dihedral) group of order 4.

>>ii. Is there a method in Square/Rectangle case that one might want to
 override
>>for performance reasons? It seems to me that we don't need to introduce
 Square
>>type at all.
>
>Unless one wants a variable that is a square and must always be a square for
>reasons other than performance.

Such as a convenient name? Rectangle with a constraint wouldn't do? Received on Fri Jul 20 2001 - 02:16:48 CEST

Original text of this message