I'll read over the Wiki entry, thanks for the pointer.

And yes, I know about the per-loader instance thingy (thanks to Ted Neward's
Java Statics paper at http://www.javageeks.com/Papers/). In this particular
case, since it's a class with "pseudo-static" methods (no state kept between
invocations at all), one doesn't really care if each class loader has its
own. So having an instance() method works fine. If you want an os-specific
instance of FileUtils instead of the default (or defaults for each class
loader ;-) for the current platform, simply new it directly, or with use a
new factory method on FileUtils, passing in the OS. Many less FileUtils
instances created...

Anyway, I'm neat-picking as always. I can't argue that there's no pressing
need for it ;-) --DD

-----Original Message-----
From: Stefan Bodewig [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 18, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: Re: Persistent global properties - are they going to be avail abl
e?

On Thu, 18 Apr 2002, Dominique Devienne <[EMAIL PROTECTED]> wrote:

> Not much left to argue when you bring in "truth" like this, is
> there...  A case a coding fundamentalism!?!?!?!

I'm known for my dogmatism, yes (BTW 8-) is my version of other
people's :-) or ;) or ... you get the idea).

"singletons are evil" is a broad statement and I don't claim ownership
for it <http://c2.com/cgi/wiki?SingletonsAreEvil>.

I don't think one should use singletons blindly but ask oneself
whether there is a reason that one really only wants a single instance
at any given situation.  There certainly are good use-cases for the
singleton patter, but I don't think there is a pressing need for this
in the FileUtils case.

And when you are coding in Java remember that you'll always have one
singleton instance per classloader for your sinleton class.

Stefan

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

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

Reply via email to