No such thing as a small change | |
PerlMonks |
How to get a container-component proxy thing?by flowdy (Scribe) |
on Apr 07, 2014 at 19:44 UTC ( [id://1081434]=perlquestion: print w/replies, xml ) | Need Help?? |
flowdy has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Moose provides a powerful means of delegation one can use, the handles parameter to 'has'. The problem I see with it while planning my software architecture is that the object shall not have full and general access to the object it delegates to, so a direct link to the delegate I consider something to avoid. Plus, specific to the problem to be solved with the delegated call, private methods could be used at delegate side directly, what reminds of friend keyword in C++, I am not sure. In my case, the delegating instance is a component, the delegate is a container that links to the said instance in a part-of-me relation. This is a circular reference I would have to weaken in one direction to prevent a potential memory leak, by the way, but this would be no problem. My made-up plan of implementing this appears to be no better than simple and general delegation at last, even though considering just other aspects, maintainability in the first place, and not to forget scalability. How do experts this kind of pondering fruits?
Hope you wise, dear monks can shed me some light on how to do it right. I probably just miss a proper overview on design patterns, that is, the ability to properly comprehend the often toughly abstract description of these. Thank you for reading (+ replying),
Back to
Seekers of Perl Wisdom
|
|