in reply to OO vs. global variables...
Now, one thing I'm gagging on (and this may just be unfamiliarity with the process) is should every object have a pointer to the Board? I mean, should the Point know who its Board is, so to speak?
Yes. A Point needs to know who its Board is so that it can delegate certain questions/actions to its Board.
Having a contained object delegate questions about "location" and "neighbors" to its container is a frequent pattern in OO-land. It usually leads to smaller (and more flexible) class definitions for the contained objects.
Try approaching the problem by way of the question "Which is a more appropriate place to implement this behavior: Board, or Cell?"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (dws)Re: OO vs. global variables...
by dragonchild (Archbishop) on Sep 04, 2001 at 22:16 UTC | |
by dws (Chancellor) on Sep 04, 2001 at 22:40 UTC | |
by dragonchild (Archbishop) on Sep 04, 2001 at 22:55 UTC |
In Section
Seekers of Perl Wisdom