"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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?"
In reply to (dws)Re: OO vs. global variables...
by dws
|
|