[Tutor] two questions..

Israel Evans israel@lith.com
Wed, 14 Nov 2001 15:56:34 -0800


||  Some of this is a bit confusing to me :

Hmmm, let me try the body analogy, since that seems to be where my head is.
:)

Let's say that you have a formula for specifying what percentage of body fat
that a particular region of the body should have.  All constraints of
minimum and maximum aside, if we wanted to change the weight of the body but
have the specified body part deviate from it's normal fat distribution, how
would this best be set up?   Ok now for D&D analogies...  If you got two
magical rings of Polymorphism, one that made you hugely fat and one that
reduced that annoying wiggly neck wattle, we would need to have some sort of
object that affected the normal way in which calculations are done on our
character.

Could this be done by having the regular calculations for body weight look
for any modifier thingamabobs and if it found some, factor that into the
calculations, and if not, then just do the calculations as normal?



||  You want to know what the Composer instance is?  It is just an object. 
||  The fact that is uses composition instead of inheritance is mainly an
||  implementation detail.  Often times, though, composition is preferred 
||  over inheritance because it reduces icky inheritance trees.  In python,
||  composition is much easier since __getattr__ and __setattr__ 
||  can be written to automatically defer implementation to the internal 
|  objects without actually writing all the methods.

So, if an object is considered (or is focused, or concerned with) two
different parts of two separate things, then I'd make a composite of the two
things?   I understand this concept in respect to multi part objects, but
when it comes to something like a joint which isn't concerned with the
entirety of the two objects that have come together, but the specific points
at which they come together and the functionality that arises out of such a
coupling, my mind seems a little fuzzy.

I think I'll have to check out that design patterns book, I've heard it
mentioned before!

Thanks!

~Israel~