title: Message passing between objects - How to refer to the target object?
body: <p>The most basic task in an object oriented environment is executing a method on an object. To do this, you have to have a reference to the object on which you are invoking the method. Is the proper way to establish this reference to pass the object as a parameter to the constructor (or initializer method) of the calling object?</p>
  
  <p>If object <code> foo </code> calls into object <code> bar</code>, is it correct to say (in pseudo-code):</p>
  
  <pre><code>bar = new barClass()
  foo = new fooClass(bar)
  </code></pre>
  
  <p>What happens if you need to pass messages back and forth? Do you need a method for registering the target object?</p>
  
  <pre><code>foo = new fooClass()
  bar = new barClass()
  
  foo.register(bar)
  bar.register(foo)
  </code></pre>
  
  <p>Is there a pattern that addresses this?</p>