title: What is the purpose of a delegation pattern?
body: <p>I was looking through the source to <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/hardware/SensorManager.java;h=f079e42a9993ddd57303bb19fd6462db48ae5345;hb=HEAD">SensorManager</a> in Android and found that when you register a <code>SensorEventListener</code> the <code>SensorManager</code> passes control of the listener to a <code>ListenerDelegate</code>. </p>
  
  <p>I only bring this up as an example. I read <a href="http://en.wikipedia.org/wiki/Delegation_pattern">the Wikipedia article</a> on delegate programming but I am still not sure of its purpose. Why would one use a 'delegate'? How does it help the control flow of a program? What are the disadvantages of using (or not) one? Is it most practical for use with listeners?</p>
  
  <p>Edit: <code>ListenerDelegate</code> is on line 487 and the methods in question are around line 1054.</p>