Tell, Don't Ask



Hi everyone. I've been reading quite a few old posts from this group,
and have found it to be a very educational experience. I'm grateful
for the knowledge I've gotten so far from the smart people who post
here.

I think I have a pretty good understanding of OO, but sometimes I have
difficulty applying it in practice. The concept that I am currently
grappling with is something which I've seen referred to as "tell, don't
ask." My understanding is that OO purists frown upon having lots of
getter-methods because it tightens coupling. As I understand it, the
preferred approach is to design objects that examine their environment
and then "blindly" send messages to other objects correspondingly.

My question is as follows. How can an object know about its
environment without "asking"? Is every object supposed to contain all
the information it needs, obtained by receiving messages from other
objects?

Thanks.

.



Relevant Pages

  • Re: Tell, Dont Ask
    ... I'm grateful ... I think I have a pretty good understanding of OO, ... preferred approach is to design objects that examine their environment ... obtained by receiving messages from other ...
    (comp.object)
  • Re: What is/is not considered to be good OO programming
    ... > get a twelve business class project working in almost any environment. ... you have an efficient development environment. ... > reply to any more of your posts. ...
    (comp.lang.php)
  • Re: AounSays: March 14 Members Are Sons of Bastards!
    ... I never said Aoun was not part of Lebanon, ... is flexible and understanding does not match my understanding of him. ... I expect a little balance in your posts. ... him and the same hardcore allies of the Baathists. ...
    (soc.culture.lebanon)
  • Re: Edward Younan is really angry at me for exposing LifeMirage!
    ... I was holding off on this; trying to be understanding of poor ... where Edward Younan AKA LifeMirage (who also posts under Steve Sliwa) ... "if Leadership wishes to post anything regarding my leave... ... "I'm understandable very upset that Bruce, ...
    (rec.drugs.smart)
  • A LifeMirage grammar lesson
    ... I was holding off on this; trying to be understanding of poor ... where Edward Younan AKA LifeMirage (who also posts under Steve Sliwa) ... "if Leadership wishes to post anything regarding my leave... ... "I'm understandable very upset that Bruce, ...
    (rec.drugs.smart)