|
Posted by Joseph Brenner on March 26, 2007, 7:45 pm
Please log in for more thread options
> Joseph Brenner wrote:
>> I've got a question about naming a module I'm about to finish up
>> and put up on CPAN. At present, it's essentially it's a set of
>> routines that run SQL scripts that initialize a database schema
>> for a particular project. It also includes features to drop a
>> schema, and a key feature (for me at least) is that it refuses
>> to do this unless the schema is named something like "*_test".
>
> <snip>
>> Because hypothetically it might be possible to create a less
>> database-specific version of this:
>> Database::Initialize
>> But considering that I might release a few things like this,
>> (and other people might do ones for other databases) I could
>> see an argument that it might make sense to handle the
>> namespace like this:
>> Database::Postgresql::Initialize
>> Database::Postgresql::Util
> how about using a factory method:
>
> my $dbuh = Database::Initialize->getInstance(
> "postgresql",
> { user => $username,
> password => $password } );
> $dbuh->drop_test_database( $dbname );
>
> thus ensuring consistent syntax across implementations.
So your idea would be write a "Database::Initialize" that's essentially
an interface, and have it access "Database::Initialize::Postgresql"
(or whatever) as a plug-in, or driver? That sounds like a reasonable
architecture.
That would open up the door to the notion that perhaps it should be
in the DBIx namespace... but then, the database-specific backend
might or might not go through DBI, so "Database" would still seem
like the better choice to me.
|