Re: OO Architecture redux
[email protected] (Jochen Wiedmann) Wed, 05 Oct 2005 01:34:15 +0200
| Newsgroups | perl.dbi2.dev |
|---|---|
| Message-ID | <[email protected]> |
Tim Bunce wrote:
> - As an alternative to manipulating the internals of the handle,
> applications could compose new anonymous classes by mixing multiple
> roles. Here's an extract from the roles docs url above:
I must admit that I have difficulties to understand the "roles" stuff.
For example:
> $fido does Sentry does Tricks does TailChasing does Scratch;
Is it possible that TailChasing.chase invokes Sentry.chase? If so, then
I would think that this opens a lot of interesting options.
> To HAVE-A handle or to BE-A handle, that is the question:
Considering the above, I do not think so. For example, it might look
like this:
DBD::Base::Dbh \
$dbh does DBI::Dbh::Logger does DBI::Dbh::This
DBD::Driver::Dbh /
DBD::Base::Dbh might be a class provided by the DBI, which the driver
handle does subclass. The various roles sitting in front of the actual
handle leave complete freedom to the DBI. However, the driver class is
still very simple (which was my original intention).
> The win is that the price for re-dispatching the method calls is only
> paid by those who want to use it.
If I get the roles stuff right, then it offers to do the dispatching
stuff for you. And if so, you should not attempt to rebuild it.
Jochen