No, you wouldn't, because the specially-formatted DSN string never needs to be constructed at all, for any reason.
I see. So you're volunteering to go through and modify all the 600+ DBD::* modules; and all the modules that use them; and all the code written in the last 15 years that use them; just so that you can provide introspection of things that nobody will ever want to introspect?
Let's just pretend for a moment that we could re-write history, and DBI had specified that the first parameter to DBI was a hashref. And (say), the only required pair was dbi => Pg|MySQL|Whatever. And that each DBD was free to require whatever pairs it needed. What does that achieve?
You would have a hash rather than a string. That would make it easier to wrapover in your DSN object--though this parsing you speak of is hardly onerous. But then, as now, that wrapover is pointless.
$hash{ $key }++ is infinitely preferable to $dsn->keySet( $key, $dsn->keyGet( $key ) + 1 );
You can't hope to validate all the possibilities. And there are no useful methods beyond get/set/iterate you could apply to it.
Even ignoring that you'd:
Which is impractical as each DBD has its own unique set of requirements
Which besides any problems with eval, means that
Which many own don't currently have, and neither need nor want to have;
Unless you envisage passing your DSN object to DBI and have it pass it through to the DBDs (another breaking re-write).
So then all the DBDs acquire yet another dependancy for no good purpose beyond the creation of OO tagliatelle.
So, even if we could ignore history, and turn back the clock to do things your way, there'd be no value in it. And a considerable downside of increased complexity and dependancies.
OO is fine and dandy when used properly, but using it to enforce a one-size-fits-all syntax fetish is no good use. Like all programming tools, the trick is to know when to use--and when not to.
You may think that I don't agree with you, because I haven't tried the KoolAid yet, but you'd be wrong. I tried your flavour of KoolAid (along with most others) a long time ago, I just didn't like it. Or rather, can tolorate all flavours, each is fine for certain occasions, but I see no good reason to limit myself (or others) to just one flavour. Of anything.
In reply to Re^7: Avoiding compound data in software and system design
by BrowserUk
in thread Avoiding compound data in software and system design
by metaperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |