|P is for Practical|
Design Flaws in DBIx::Connectby princepawn (Parson)
|on Jul 22, 2003 at 15:49 UTC||Need Help??|
DBIx::Connect came into being after repeated patch submissions to the author of DBIx::Password were rejected. So I designed the module based on practical immediate needs and it was useful enough for other people that wanted to make mods that I put it on sourceforge.
Now I am on a new database-project and just realized something: there is more to configuring a database application than setting up a database connection.
In particular, right now, I need to have information about which table is my master table, which table is my leads table, etc. And of course, the initial call to DBIx::Connect should return more than a $dbh, it should return the configuration object also.
Now, if all the methods of the module returned a scalar as its first argument, it would be simply a matter of returning the configuration object as a second scalar. But I was short-sighted and returned arrays and hashes for the methods which returned aggregates:
And why? It certainly is less efficient to return copies than references.
But now I am stuck with my design decision unless I make a major API change and have every call return a scalar as its first argument. The other option is to have one call to get the connection information or database handle and make a second call for a configuration object, but this inefficient and doubles the lines of code needed for using the module.
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality