Re: design dilemma

From: Cristiano Sadun (TAKEcristianoTHISsadunOUT_at_hotmail.com)
Date: 03/05/04


Date: Fri, 5 Mar 2004 12:46:54 +0000 (UTC)

TheFerryman <ferry@onthenet.com> wrote in
news:36qg40h08n230pdj61klvq719p54j666eg@4ax.com:

> One thing that struck me this morning is that the following two
> classes provide exactly the same functionality but, if I understand OO
> correctly, most OO programmers would say the second version is bad
> design. Is that correct?

Dont think so. Actually the opposite. I favour using composition over
inheritance unless there's a real strong and provable generalization
involved. In your example, a Body is no way a generalization of a Sense (if
a get the meanings right :-) so I would consider the first as bad design.

The possibly "bad" thing about the second - the accessors - is still
another issue, which can't be captured well at that example's level of
abstraction, dealing to the fact that while a body has senses, they
shouldnt be available as such outside its boundaries.

For your original problem: you want to model a cat, which has vision and
memory, but you make vision depend on memory. If your intent is to allow
vision to coordinate with memory, I'd say that that's what a Brain is for.
:)

-- 
You dont know what to do when you dont know what you're doing.
http://space.tin.it/computer/csadun


Relevant Pages

  • Re: BSOD problem with 0x000000f4
    ... i got the bsod again today, ... i dont seem to get the stop error. ... Memory: 2046MB RAM ... so I noticed your system is reporting physical RAM as 2046. ...
    (microsoft.public.windows.server.general)
  • Re: Invariant Recognition, Grandmother Cell, and Memory Hierarchy
    ... >Hawkins further writes about the importance of prediction and the need ... >to organize memory into feedback-driven hierarchies. ... Invariance is an important aspect of VISION, ...
    (comp.ai.philosophy)
  • Re: VIRTUAL MEMORY
    ... each drive / partition. ... > anything because I dont know what I should or should not delete. ... > virus scan both from the nortons that I have and also from live update, ... physical memory. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: VIRTUAL MEMORY
    ... My page file usage is 695 mb ... If you get anything much more than 50 mb virtual memory ... In task manager look at the performance tab and repost the PF ... I dont quite understand what program you say ...
    (microsoft.public.windowsxp.perform_maintain)
  • Samsung a970 Questions / Comments
    ... Any chance I ... Does this phone have enough memory to run a music playlist while ... I dont like the fact that this phone doesn't have a miniUSB ... online vendors have it for $99 after a bunch of rebates. ...
    (alt.cellular.verizon)