* Dave Rolsky <[EMAIL PROTECTED]> [2007-05-09 16:05]: > "All problems in computer science can be solved by another > level of indirection" (Butler Lampson) > > ... except the problem of having too many levels of > indirection.
The funny thing is: that’s wrong! You can add a layer of abstraction on top of an overly-indirected system that lets you use the underlying system without knowing about the indirections in it. :-) * Dave Rolsky <[EMAIL PROTECTED]> [2007-05-09 17:15]: > I have a very minimal Response subclass that simply adds some > accessors: > > package VegGuide::Response; > > use base 'Catalyst::Response'; > __PACKAGE__->mk_accessors( 'alternate_links', 'breadcrumbs', 'keywords' ); > > That's the subclassing piece. The delegation is that rather > than implement the functionality of breadcrumbs in the response > object, the breadcrumbs accessor simply returns a > VegGuide::Breadcrumbs object. Delegation means that the caller communicates only with the object that delegates and doesn’t know which object does the actual work. That’s not what’s happening in your example. Something like this would be delegation: sub trail_length { my $self = shift; $self->breadcrumbs->trail_length; } Here the caller talks only to VegGuide::Response and doesn’t even know that there’s a VegGuide::Breadcrumbs object behind the scene. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/