On Thu, 31 Mar 2005 15:06:05 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> On Thu, March 31, 2005 1:57 pm, Craig McClanahan said:
> > Every single time I've created a static utilities class (and that
> > includes things like Commons BeanUtils) I have regretted it, because
> > users are stuck with the functionality you provide and cannot
> > customize.
> 
> I don't follow... isn't the problem you mention exactly what inheritance
> is meant to solve?  You aren't making those utility classes final, are
> you? :)
> 

Most often, this sort of class is called directly from within a method 

  Utility.staticMethod(parameter); 

Unless a reference to the static class is passed around somehow,
there's no opportunity for inheritance to come into play.

Of course, there are other approaches, like singletons and Dependency
Injection, that would provide for utility classes and inheritance. But
once you go there, the cure can become as bad as the disease. :(

In principle, I would tend to agree with Craig. There should be a core
interface and a second member with the convenience methods, to save us
each the bother of writing the convenience methods ourselves. (After
all, that's what a framework is all about -- sharing the wealth.)

I would just take it a step farther and made the second member a
proper subclass with its own interface, as Spring does with
ObjectFactory and ApplicationContext.

-Ted.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to