Re: OOP Question

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi, ck (if that's your real name 8^) ),

I wasn't trying to argue, I was just trying to help you clarify things. If
your opinion differs from mine, that's extremely cool -- after all, it's
YOUR program we're discussing.

If you want to know my true personal opinion, it is an extremely relevant
and pointed argument against OOP, which OOP itself creates, that issues of
this sort arise and steal hours of people's thinking time when they could be
doing more meaningful design or implementation work.

Maybe (just maybe) AFTER I get the whole thing working via procedural
programming, I can then intelligently REdesign something like this,
assigning the responsibility for carrying particular bits of data and
initiating particular actions to certain classes of objects. But all too
often, I see actions being performed ON a group of things, that make little
or no sense outside the context of the group. (As you point out, a game
piece has a position and moves [or is moved] only in the context of the
playfield.)

So what performs the action? The "program" object, which OOP really tries to
exclude and pretend does not exist, does it TO the complex of data
structures that are meaningful in the context of the program. Period.
Gymnastics and gyrations that force you to pretend that something else is
happening are doing nothing but forcing an artificial and fundamentally
false view of the proceedings on the programmer, the program, and anyone who
tries to understand the program in the future. And I submit that anything
that does that is doing a disservice, rather than improving matters.

You refer to the "god" object. Same as the program object, or the omniscient
programmer as shey embody sheirself in the code (where shey, sheirself are
gender-neutral singular pronouns of my own invention). Sorry, but OOP is a
godless approach to programming, where every data structure becomes a
demigod, but a god is unnecessary; and if a program has a (created) god,
shey has strictly limited powers. More pointedly, shey has only powers that
are explicitly granted, in the same way that powers are granted to other
objects; and maybe that is a good thing, in the context of programming.

I am basically amused by this whole discussion from an abstract point of
view. On the other hand, maybe we all stand to learn form it, myself
certainly included.

You must realize that there's (necessarily) a big difference in our
viewpoints. You're in the middle of designing and programming something that
obviously means a lot to you. While I am in no way inclined to trivialize
what you're doing, my POV is more aloof, and I'm more interested in taking
an abstract view of the whole ball of wax.

Saying that, to me a playfield should be a "stupid" thing - in the sense
that, what does the playfield neeed to know, or be responsible for? Suppose
I want to write a program about astronomy. Planets, stars, and other bodies
have positions in space, and the rules of physics determine where they can
move to next. If I want to know the position of the Earth at 4:04 AM on
November 25, 2000, I am more inclined to formulate my query as
earth.position("2000:11:25:04:04") than as space.position("earth",
"2000:11:25:04:04"). I just don't see any sense in asking space where each
object is in relation to it. It's simpler (note, one less argument, since
position in *space* is the only position that's meaningful) to ask each body
where it is. So do I want space to "know" where a potentially infinite
number of bodies are at all times, or do I want each body to know its own
whereabouts, velocity, and trajectory? I think, the latter. Of course, the
whole situation is a lot less complicated with game pieces on a playfield,
my analogy is imperfect, and we're free to treat bodies in space and game
pieces on a playfield completely differently. However, to me this analogy is
somewhat persuasive, or at least it's a way of illustrating the approach to
your progblem that I would tend to take, were it my problem.

Now, if I were introducing additional coordinate systems, and positing that
that a body could have independent positions in different coordinate
systems, that would be a different matter. Maybe Earth has one position in
space, and a completely different position in hyperspace. But who cares,
unless Earth can hold both positions simultaneously? If so, then I could
query earth.position(hyperspace, time) or hyperspace.position(earth, time);
but if Earth can't be in both space and hyperspace simultaneously, then my
code would look more like this: earth.context = hyperspace; pos =
earth.position(time) -- where I am back to the simplicity of a single
argument and the sense of rightness that (to me) goes along with that
simplicity.

Kudzu is a vine that was imported into the US to help prevent soil erosion,
and proceeded (and is still proceeding) relentlessly to cover everything,
smothering native vegetation and creating a uniformly unattractive (unless
you *really, really* like the looks of kudzu) blanket over the landscape
wherever it has become established.

Astronomically,
George (my real name, which my parents saw fit to give me)

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu