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.# DBIx::AnyDBD usage: my @connect_data = DBIx::Connect->data_array('dev_db'); my $dbh = DBIx::AnyDBD->connect(@connect_data, "MyClass"); # Alzabo usage my %connect_data = DBIx::Connect->data_hash('dev_db');
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.
I think I will just make the API change as no one uses this module with Alzabo or DBIx::AnyDBD other than me.
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
In reply to Design Flaws in DBIx::Connect by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |