The dispatch pattern in Android
satya - Wed Nov 07 2012 10:46:37 GMT-0500 (Eastern Standard Time)
Refer to a composite pattern if you wish here
satya - Wed Nov 07 2012 10:46:54 GMT-0500 (Eastern Standard Time)
Views and view groups in android form a composite pattern
Views and view groups in android form a composite pattern
satya - Wed Nov 07 2012 10:48:18 GMT-0500 (Eastern Standard Time)
For a given method 'm1()' that is applicable on a view you can see a 'dispatchm1()'
m1()
  onM1()
  dispatchM1()
satya - Wed Nov 07 2012 10:49:25 GMT-0500 (Eastern Standard Time)
An example
draw() {
  ...
  onDraw() //myself
  dispatchDraw() //children
  ....
}
satya - Wed Nov 07 2012 10:51:17 GMT-0500 (Eastern Standard Time)
Android dispatch pattern
Android dispatch pattern: wonder if anyone else is talking about this!
satya - Wed Nov 07 2012 10:53:52 GMT-0500 (Eastern Standard Time)
based on this a collective node in the composite can do
ViewGroup {
onDraw() { implment own draw };
override
dispatchDraw() {
  for each child
     child.draw()
}
}
satya - Wed Nov 07 2012 10:54:49 GMT-0500 (Eastern Standard Time)
So now you could refine the pattern a bit more
m1()
  onM1()
  dispatchM1()
    child.m1()
satya - Wed Nov 07 2012 10:58:17 GMT-0500 (Eastern Standard Time)
Here is a list of (Gang of Four) design patterns
Here is a list of (Gang of Four) design patterns
One should keep these handy, especially the tricksies like the visitor!