[cgiapp] Class::MOP? Really?
Ron Savage
ron at savage.net.au
Sat Oct 20 17:33:39 EDT 2007
Ben Hitz wrote:
Hi Ben
> I am not a fan of inside-out objects in perl, because I have much old
> code which uses old-style hash objects.
> It's confusing to have two types (although technically usable).
Your use of 'because' there is meaningless.
Before someone adopts inside-out objects, /all/ their code is 'old-style
etc'. And almost every line of code in CPAN is 'old-style'. So what :-)?
This preponderance of old-style code, in itself, tells you nothing about
whether or not inside-out objects are better, worse, or the same old
same old. It simply means a vast amount of code was written before
inside-out objects hit the big time.
In other words, we use what we have learned. For those of us who are
just about to try inside-out objects, without necessarily adopting them,
it's a choice between conservatively sticking with old-style code or
expending the effort to investigate something (inside-out objects in
this case) which, if adopted, will actually require retraining the old
brain a bit.
This situation is similar to a job I've just applied for, where Perl
Best Practices (PBP) is the mandatory way of writing code. I certainly
won't have to make as many changes to adopt PDP as a lot of other
programmers would (if I get the job), but I recognize there will be many
little places where I'll have to stop and think about what I'm writing.
And that's no bad thing, just an effort.
And there's no escape from the fact that Perl, and software technology
in general,
are not static entities. They evolve, become more complex (perhaps
unfortunately), and we can really only claim to be professional
programmers if we are prepared to make some sort of effort to keep
up-to-date (as distinct from mindlessly adopting the latest offerings
from the loudest fanatics).
> We have been converting our hand-rolled Database API to DBIx::Class,
> which uses Class::Accessor (actually an extension written for DBIC)
> called Class:Accessor::Grouped and Class:C3 to dispatch.
The fact that I prefer Rose to DBIC doesn't mean you should switch to
copy me. Just investigate, cogitate, and choose the one you most like
the look of. Before switching from Class::DBI to Rose, I read hundreds
of msgs on the DBIC mailing list, but couldn't bring myself to feel
enthusiastic about it.
Adopting Rose required retraining myself, but after a very short while
it just went Click! in a powerful way. So I asked myself - why is that?
It's a feeling so it's difficult to articulate - but the word I now use
is familiarity. Writing DBI code in Rose feels just like writing
anything else in Perl. It (Rose) is a natural fit to Perl. But I'll say
it again - just because it suits some of us doesn't mean it has to suit
all of us.
--
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html
More information about the cgiapp
mailing list