A good answer might be:
- Is the tube of tennis balls an object?
- Yes. It has
identity (my tube of balls is different than yours), it has state (opened,
unopend, brand name, location), and behavior (although not much.)
- Is each tennis ball an object?
- Yes. It is OK for
objects to be part of other objects. Although each ball has nearly the
same state and behavior as the others, each has its own identity.
- Could the top two balls be considered a single object?
-
Not ordinarily. Each has its own identity independent of the other.
If they were joined together with a stick you might consider them as one
object.
- Is the color of the balls an object?
- No. It is a property
of each ball.
- Is your understanding of tennis balls an object?
- Probably not,
although it is unclear what it is. Perhaps it is a property of the
object called "your brain."
|
Software Objects
Many programs are written to do things that are concerned
the real world.
It is convenient to have "software objects" that are similar to
"real world objects."
This makes the program and its computation easier to think about.
Software objects will have
identity, state, and behavior just as
do real world objects.
Of course software objects exist entirely within a computer system
and don't directly affect real world objects.
|