Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Delegation.
I found it interesting that this let me easily move around which helper class or which of a set of collaborating classes actually implemented the thing. B and C contain references to the A parent, and the 'has' 'handles' construct can specify to delegate all the functions that A is providing. Likewise, the variable in A that holds its B also delegates functions that B implements. Methods in either class can just refer to functions in the overall complex, and not care which object is handling it. If you move a function, you change the 'has' lines but no other code! This is inside what you are calling B: Both of those are pointing back to A. But I could further break up A and make the tag formatter into yet another separate class later! —John In reply to Re: Moose design question
by John M. Dlugosz
|
|