Does it make sense to remove slots ?

Brian Rice water at tunes.org
Mon Nov 8 20:04:51 PST 2004


Okay, I'm kind of tired of the philosophical/theoretical/rhetorical 
discussion at this point. :)

So in the hope that a mildly put-my-foot-down response will get people 
to think about improving the actual code, my recommendation is to not 
have a separate Circle traits from Ellipse traits, and just let radius: 
set both radii. In particular, handle circleness as a coincidence for 
the most part if someone sets xRadius and yRadius to the same value 
outside of that context (i.e. make an isCircle method).

Just do it and don't be so uncertain about things.

On Nov 7, 2004, at 1:36 AM, Pupeno wrote:

> I'm creating some objects for Ellipses and circles and I have the 
> following
> code:
>
> Graphics addPrototype: #Ellipse derivedFrom: {Area}.
> Ellipse addSlot: #center.
> Ellipse addSlot: #xRadius.
> Ellipse addSlot: #yRadius.
>
> Graphics addPrototype: #Circle derivedFrom: {Ellipse}.
> Circle addSlot: #radius.
> Circle removeSlot: #xRadius.
> Circle removeSlot: #yRadius.
>
> c@(Circle traits) xRadius [ c radius ].
> c@(Circle traits) xRadius: r [ c radius: r ].
> c@(Circle traits) yRadius [ c radius ].
> c@(Circle traits) yRadius: r [ c radius: r ].
>
> for me it makes sense since Circles are special cases of Ellipses 
> where both
> radius are the same, so, whatever method I can apply to an Ellipse 
> should be
> also available to Circle, except that a Circle can have only one 
> radius.
> That's why I removed the slots, created another one, and then created
> accessors as if it was an Ellipse. Maybe the write accessors shouldn't 
> be
> there.
> Or, am I totally confused ? Does this make sense ?
> -- 
> Pupeno: pupeno at pupeno.com - http://www.pupeno.com
>
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list