At 02:31 AM 5/25/01 -0400, Chip Turner wrote:
>Gunther Birznieks <[EMAIL PROTECTED]> writes:
>
> > However, I think it is reasonable to make the interface to support a
> > data source for the widgets flexible and object based to make it easy
> > for someone to write a DBI source, a DBM source, an LDAP source, an
> > Apache::Session source or whatever anyone wants really. I happen to
> > think DBI and Session sources are cool.
>
>I agree; unfortunately writing classes to interface to all of these
>would be difficult, and it would be difficult to be futureproof. When
>you hit LDAP and DBI you must then worry about databases, tables,
>servers, usernames, passwords, etc. It can become cumbersome to do
>the simple things.
I disagree. I've written interfaces like this before to LDAP and DBI. The
constructor (or config method) on a data source is stuff like usernames/
passwords, and in the case of LDAP, schema mappings.
As long as the actual methods for getting and setting the data are the
same, you just can get away with making the constructor for the data source
the place where you define all this driver specific stuff.
The design pattern here is that driver specific stuff goes into a
constructor or config method. But leave the rest of the methods alone. This
allows you to plug and play the objects.