[EMAIL PROTECTED] wrote:
> At the risk of starting an OO war... > > In general, I have found that subclassing is not a very good idea when using > other authors modules (such as CPAN modules), because one has to be very > careful in your sub-class to not overwrite a key, that that has a different > meaning in the super-class... and this could change as new versions of the > sub-class are installed. > > I have found that containment (a HAS-A relationship) combined with an > AUTOLOAD function which delegates undefined functions to the contained > object instance (in this case a dbh), is far safer, easier, works well, > gives you your own class heirarchy, and avoids all these problems. > > I think that inheritance is far OVER used in many OO systems. I agree on that last point. But I still base the decision on the answers I get by asking myself the standard is-a/has-a type questions. On your last point, I see a lot of has-a type problems being solved with inheritence. Wrong. Your name space point is a valid one. DBI solves this by tying the hash and only allowing new keys to be added if prefixed with 'private_'. With my own classes I take a somewhat similar approach. The hash is tied and keys are enumerated at the class level. When packages are compiled, the is-a tree is examined for key conflicts (sort of anyway ...). So there are ways, although I admit setting all that up was some work. Fun work though. 8-) I like the AUTOLOAD idea. I'll add that to my list of approaches. -- Steve Sapovits Global Sports Interactive http://www.globalsports.com Work Email: [EMAIL PROTECTED] Home Email: [EMAIL PROTECTED] Work Phone: 610-491-7087 Cell Phone: 610-574-7706
