Screamin Lord Byron wrote:
On 06/26/2010 03:15 AM, Eric Sosman wrote:
...
to lump a whole aviary
of Pollys and Snoofleses and FeatheredBastards and so on into
Parrot. Or, let it be said, into Bird.
You will lump it according to your lowest needed level of abstraction.
If your lowest level of abstraction is bird, then you'll only have
instances of the Bird class, but not instances of the Animal class. If
your generalization needs to be more specific, then you'd have instances
of the Parrot class, but not of the Bird and the Animal classes.
What are you supposed to do if the appropriate level of abstraction
varies at run time?
I'll sometimes think "There's a peacock" or "There's a mallard duck",
but at other times "That's a very elegant brown bird". The level of
abstraction changes depending on the information I have about the bird.
Sometimes I have enough information to classify the bird by species,
sometimes by general type - I can tell the difference between a duck and
a vulture, without necessarily knowing the exact species - and sometimes
just by "bird" plus description.