[Tutor] Re: Re: Factory classes (etc)
Arthur
ajs@ix.netcom.com
Sun, 8 Sep 2002 10:08:53 -0400
>It's really difficult to help you when you are so abstract.
>To be honest, I don't really understand what you are trying
>to do. I think it would be easier if you showed a sample of
>code.
Well actually at this point I am not so much asking for specific help. More
trying to get a better overview of certain OO concepts that are inherently
abstract, at least to me.
>The thing is, that if you have the same name, you should
>basically do the same thing.
Now this seems to be somewhere near the gist of my issue. I want things to
have the same name for objects if they end up as objects with the same
essential attributes. How they get to have those attributes may be totally
different. A Chord, for example, might be derived as the intersection of a
line and a circle, the intersection of 2 circles, the intersection of a line
and a sphere. The key attributes of a Chord are its endpoints. Depending
on the the kinds of geometric objects fed in as input, the routines to
determine those endpoints differ fundamently, but at the end I have the
precisely same kind of an object - whose essential attributes are its two
endpoints. They are precisely the same kinds of objects because if I give a
Chord as an argument to the creation of another geometric object, it is of
no relevance whether that Chord was orginally created by 2 circles, or a
sphere and a line.
Now in my mind Java method overloading addresses this need head-on. But
maybe that is where I am confused and creating confusion - because though I
had done some Java, I much prefer Python - and my Java understanding is
actually much more vague than my Python.
At any rate, the algorythm I keep referring to, would be an absolutely
generic function to which I could feed lists of acceptable arguments for a
Class, and get, as a return, information sufficient to inform the Class
which specific routine it needs to call to create its essential attributes -
in the case of a Chord, its endpoints.
My tutorial need, I guess, is some ratification that my understanding and
goals and approach are sensible.
Art