Hardy Merrill wrote:

> I'm not trying to be a pain in the a__, but I would really
> appreciate a "primer" on "How Subclassing DBI.pm can benefit you"
> directed at people who haven't subclassed the DBI.pm before.
> Does something like this already exist?  If I understood it
> and knew more about it, I might have more input on how much
> the proposed enhancements make sense(or not).


Speaking as a DBI user, and not really a developer of DBI modules,
I can say this regarding your subclassing question:  In general,
using OO models I've found I always end up subclassing to take
something general purpose and map it to what I call "enterprise"
objects.  By that I mean higher level objects that take into account
"the way things are done" in the business you're using the objects
in.  You start to see this as you repeat the same set up code,
error handling code, etc. that's specific to your place of business.
Once I see these patterns, I subclass and wrap them into enterprise
classes so the repeated code is in one place.

In the case of DBI, my subclass is pretty thin.  Right now it just
takes common names we use for databases and maps them to connection
strings.  The power of that is that we've changed the underlying
connection strings several times; e.g., the database we refer to as
"developer" has moved a few times and had its connection strings
changed in the process.  Having these specifics all wrapped in my DBI
subclass means my outside DBI users always use the abstract names and
my wrapper takes care of changing the underlying values as needed.
It also means I can easily switch to test versions of databases, which
helped a lot when we upgraded to a new version of Oracle.

I'm also looking at adding some common error handling and tracking
code at some point -- again specific to things we do and not something
you'd find on CPAN.

If I understand Tim correctly, as long as you're properly subclassing
DBI there should be no changes required, except maybe getting rid of
the init_rootclass() method call.  It sounds like he's making DBI more
of a standard class in terms of subclassing.  DBI was harder to subclass
than others I've done, but once you do it, you understand why it's that
way.  So no big complaints from me there.

-- 
Steve Sapovits
Global Sports Interactive
http://www.globalsports.com
Work Email:  [EMAIL PROTECTED]
Home Email:  [EMAIL PROTECTED]
Work Phone:  610-491-7087
Cell Phone:  610-574-7706

Reply via email to