[Tutor] two questions..

Sean 'Shaleh' Perry shalehperry@home.com
Wed, 14 Nov 2001 12:49:18 -0800 (PST)


> 
> 2.    This one is really making my head hurt at the moment.   When I have
> two objects that come with their own attribute and functions, and make them
> work together, that third thing is something like a new object, but what
> about the particular point at which the two objects connect?   Take for
> example the upper arm and the lower arm.  Where they connect is called the
> elbow.  Would this be a separate object?  Would the Arm object be compose of
> these along with the hand, wrist and shoulder?  When the lines between
> objects get fuzzy, what do you do?
> 

sometimes you have to let go of the black and white and use the grey.  Let's
consider your body example in programming.

Say I have a game I am developing and want to represent a humanoid form.  This
humanoid will be injured during the course of the game.  In some games, you
just get one hit and you have to start over so I just have a Humanoid class. 
Then let's consider a simple fighting game.  Perhaps an opponent could target
large items like Arm or Leg or Torso.  So I could have a class for each of
those.  Then consider a really complicated game design where I could use the
Eagle claw grip on an opponents elbow.

The point is your objects should be as granular as you need.  A 3d renderer
trying to make lifelike movement probably has an upper arm connected via an
elbow to a lower arm.  A stick figure just has an arm.

If you step away from the literal the 'glue' may just be the container class.