RE: [OT] Use of Static Methods

2003-07-10 Thread Micael
developers to buy if they choose to do so too. Regards, Richard -Original Message- From: Micael [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 11:10 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods Richard, I don't doubt what you say is true, but how d

RE: [OT] Use of Static Methods

2003-07-10 Thread Yee, Richard K,,DMDCWEST
PROTECTED] Sent: Thursday, July 10, 2003 11:10 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods Richard, I don't doubt what you say is true, but how do you know this? Why couldn't the implementation of the abstract class MessageDigest not be thread-safe? Micael

RE: [OT] Use of Static Methods

2003-07-10 Thread Micael
ur code to comply with this. Regards, Richard -Original Message- From: Jerry Jalenak [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 10:30 AM To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Methods Micael, The class is called 'Password

RE: [OT] Use of Static Methods

2003-07-10 Thread Jerry Jalenak
m: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 12:56 PM To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Methods Jerry, Your methods are thread-safe. The MessageDigest.getInstance() and SecureRandom() calls are thread-safe too. One t

RE: [OT] Use of Static Methods

2003-07-10 Thread Yee, Richard K,,DMDCWEST
IL PROTECTED] Sent: Thursday, July 10, 2003 11:51 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods Could you give us the method body again? That is where we can see if there is a thread safety issue? At 07:53 AM 7/10/03 -0500, you wrote: >To everyone: WOW! Talk about open

RE: [OT] Use of Static Methods

2003-07-10 Thread Jerry Jalenak
ly 10, 2003 11:51 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods Could you give us the method body again? That is where we can see if there is a thread safety issue? At 07:53 AM 7/10/03 -0500, you wrote: >To everyone: WOW! Talk about opening a can of worms! It

RE: [OT] Use of Static Methods

2003-07-10 Thread Micael
I see that it need not be. However, hard to say what to think, since Ch. 11 is not available. I will have to take a look at this book. Looks interesting. At 10:16 AM 7/10/03 -0700, you wrote: I am still downloading, but at first blush, it looks as if Johnson's context object is also a single

RE: [OT] Use of Static Methods

2003-07-10 Thread Micael
I am still downloading, but at first blush, it looks as if Johnson's context object is also a singleton? At 04:45 PM 7/10/03 +0200, you wrote: > This sounds a lot like the ServiceLocator pattern. > But ServiceLocator u

RE: [OT] Use of Static Methods

2003-07-10 Thread Micael
6 [EMAIL PROTECTED] -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 5:34 PM To: Struts Users Mailing List Subject: Re: [OT] Use of Static Methods It's mainly a question of whether instantiating Password is an issue. If not, then make it

RE: [OT] Use of Static Methods

2003-07-10 Thread NYIMI Jose (BMB)
But ServiceLocator uses Singleton I meant ServiceLocator is implemented as a Singleton ... José. > -Original Message- > From: NYIMI Jose (BMB) > Sent: Thursday, July 10, 2003 4:46 PM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > >

RE: [OT] Use of Static Methods

2003-07-10 Thread NYIMI Jose (BMB)
> This sounds a lot like the ServiceLocator pattern. > But ServiceLocator uses Singleton. Have a look the following link at page 126 http://developer.java.sun.com/developer/Books/j2ee/dpa/j2ee_dpa_Ch3.pdf Here the aut

Re: [OT] Use of Static Methods

2003-07-10 Thread Erik Price
NYIMI Jose (BMB) wrote: In my view, it's a much better solution to have one object that can be used to locate other objects. I call this an application context object, although I've also seen it termed a "registry" or "application toolbox". Any object in the application needs only to get a ref

RE: [OT] Use of Static Methods

2003-07-10 Thread Andrew Hill
hat class (just like with Actions) - which are essentially singleton helpers called by the request processor... -Original Message- From: Jerry Jalenak [mailto:[EMAIL PROTECTED] Sent: Thursday, 10 July 2003 20:54 To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Me

RE: [OT] Use of Static Methods

2003-07-10 Thread Jerry Jalenak
s can get to the method at the same time and clobber each other? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 5:34 PM To

RE: [OT] Use of Static Methods

2003-07-10 Thread NYIMI Jose (BMB)
pplication Registry". Thx, José. -Original Message- From: NYIMI Jose (BMB) Sent: Thursday, July 10, 2003 11:33 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods DISCLAIMER "This e-mail and any attachment thereto may contain information which is

RE: [OT] Use of Static Methods

2003-07-10 Thread NYIMI Jose (BMB)
e use of reflection, and should take care of configuring the object instances it manages. This has the advantage that application objects need only expose bean properties for configuration, and never need to look up configuration sources such as properties files. -Original Message-

RE: [OT] Use of Static Methods

2003-07-10 Thread NYIMI Jose (BMB)
, and should take care of configuring the object instances it manages. This has the advantage that application objects need only expose bean properties for configuration, and never need to look up configuration sources such as properties files. -Original Message- From: Craig R. McCla

RE: [OT] Use of Static Methods

2003-07-10 Thread Andrew Hill
] Sent: Thursday, 10 July 2003 16:42 To: Struts Users Mailing List Subject: Re: [OT] Use of Static Methods On Thu, 10 Jul 2003, Simon Kelly wrote: > Date: Thu, 10 Jul 2003 09:56:14 +0200 > From: Simon Kelly <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTEC

Re: [OT] Use of Static Methods

2003-07-10 Thread Craig R. McClanahan
On Thu, 10 Jul 2003, Simon Kelly wrote: > Date: Thu, 10 Jul 2003 09:56:14 +0200 > From: Simon Kelly <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: Re: [OT] Use of Stat

Re: [OT] Use of Static Methods

2003-07-10 Thread Simon Kelly
and I will follow this up with my long awaited lecture on "Struts for coffee makers 101" ;-) Cheers Simon - Original Message - From: "Craig R. McClanahan" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; <[EMAIL PR

RE: [OT] Use of Static Methods

2003-07-09 Thread Craig R. McClanahan
On Thu, 10 Jul 2003, Andrew Hill wrote: > Date: Thu, 10 Jul 2003 10:52:53 +0800 > From: Andrew Hill <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] > To: Struts Users Mailing List <[EMAIL PROTECTED]>

RE: [OT] Use of Static Methods

2003-07-09 Thread Andrew Hill
Put them as methods of a Singleton instance instead of static methods. (Ive been using lots of static methods so the fact Im telling you to do it differently to that should indicate something ;->) -Especially when other people have to use these methods too. The number of times Ive cursed classes l

RE: [OT] Use of Static Methods

2003-07-09 Thread Jaye Bass
chnologies -Original Message- From: Micael [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 4:58 PM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods Of course they do. That is not the point. "Care" does not mean exclusion.You have stated some limited u

Re: [OT] Use of Static Methods

2003-07-09 Thread Ted Husted
K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 12:35 PM To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Methods I and a lot of other developers would disagree with the statement "Static methods are evil for many reasons including philosoph

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
es the overall memory footprint of an > > > application. > > > >That's a red herring argument. The class is loaded regardless of static > >or non-static method calls. A basic Java object is 8 bytes of memory. > >Are you going to give up on design principles fo

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
Also, singleton classes are less global too. Singleton classes can have an interface exhibiting their method signatures. But, you cannot do this, obviously, with static methods. interface Foo { static void bar(); } class Baz implements Foo { public static void bar() { // nothing } }

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
.com/pub/a/2003/06/13/design1.html José. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 9:06 PM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods --- "Paananen, Tero" <[EMAIL PROTECTED]> wrote: > >

RE: [OT] Use of Static Methods

2003-07-09 Thread Jaye Bass
tic method calls. A basic Java object is 8 bytes of memory. > >Are you going to give up on design principles for 8 lousy bytes? > > > >OO programs should be made up of objects passing messages to other > >objects, not calling global functions. > > > >David &g

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
ds, Richard -Original Message- From: Brian Lee [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 12:02 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [OT] Use of Static Methods >From: David Graham <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: Struts Users M

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
At 03:01 PM 7/9/03 -0400, you wrote: From: David Graham <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Struts Users Mailing List <[EMAIL PROTECTED]> > > 2) It is not correct to say that static methods can't be overriden. They > can > be overridden with another static method. You can't override

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
--- "Paananen, Tero" <[EMAIL PROTECTED]> wrote: > > > > OO programs should be made up of objects passing > > > > messages to other objects, not calling global functions. > > > > > >I would argue a Singleton is no better in this respect. > > > > > >The fact that they're instantiated into an object,

RE: [OT] Use of Static Methods

2003-07-09 Thread Paananen, Tero
> > > OO programs should be made up of objects passing > > > messages to other objects, not calling global functions. > > > >I would argue a Singleton is no better in this respect. > > > >The fact that they're instantiated into an object, > >don't make Singletons any less "global" than static > >me

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
At 02:36 PM 7/9/03 -0400, you wrote: > OO programs should be made up of objects passing > messages to other objects, not calling global functions. I would argue a Singleton is no better in this respect. The fact that they're instantiated into an object, don't make Singletons any less "global" than

RE: [OT] Use of Static Methods

2003-07-09 Thread Micael
d > > > > > > -----Original Message----- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 9:22 AM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > > > > > > One of my programmers asked me whether

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
ol. David > José. > > -Original Message- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 9:06 PM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > > > --- "Paananen, Tero" <[EMAIL PROTECTE

RE: [OT] Use of Static Methods

2003-07-09 Thread NYIMI Jose (BMB)
3/06/13/design1.html José. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 9:06 PM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods --- "Paananen, Tero" <[EMAIL PROTECTED]> wrote: > > OO programs sh

RE: [OT] Use of Static Methods

2003-07-09 Thread Yee, Richard K,,DMDCWEST
EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [OT] Use of Static Methods >From: David Graham <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: Struts Users Mailing List <[EMAIL PROTECTED]> > > > > > 2) It is not correct to say that static methods can't

Re: [OT] Use of Static Methods

2003-07-09 Thread Erik Price
Brian Lee wrote: That's incorrect. Static methods cannot be overridden. Actually, that's incorrect. Static method can be overridden. foo.java public class foo{ public static void bar(){} } baz.java public class baz extends foo{ public static void bar(){} } compiles Let's settle this before i

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
--- Brian Lee <[EMAIL PROTECTED]> wrote: > >From: David Graham <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: Struts Users Mailing List <[EMAIL PROTECTED]> > > > > > > > > 2) It is not correct to say that static methods can't be overriden. > They > > > can > > > be overridden with anothe

RE: [OT] Use of Static Methods

2003-07-09 Thread Kris Schneider
Again, that's hiding, not overriding. Nobody said code like yours wouldn't compile, it's a matter of correct terminology (as defined by the language spec). Quoting Brian Lee <[EMAIL PROTECTED]>: > >From: David Graham <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: Struts Users Mailing L

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
--- "Paananen, Tero" <[EMAIL PROTECTED]> wrote: > > OO programs should be made up of objects passing > > messages to other objects, not calling global functions. > > I would argue a Singleton is no better in this respect. > > The fact that they're instantiated into an object, > don't make Singlet

RE: [OT] Use of Static Methods

2003-07-09 Thread Brian Lee
From: David Graham <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Struts Users Mailing List <[EMAIL PROTECTED]> > > 2) It is not correct to say that static methods can't be overriden. They > can > be overridden with another static method. You can't override a static > method > to be non-static

RE: [OT] Use of Static Methods

2003-07-09 Thread Paananen, Tero
> OO programs should be made up of objects passing > messages to other objects, not calling global functions. I would argue a Singleton is no better in this respect. The fact that they're instantiated into an object, don't make Singletons any less "global" than static methods. -TPP - I t

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
gt; Regards, > > Richard > > > > > > -----Original Message- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 9:22 AM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > > > > > &g

RE: [OT] Use of Static Methods

2003-07-09 Thread Yee, Richard K,,DMDCWEST
-1121-mrhappy_p.html -Richard -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 10:35 AM To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Methods I and a lot of other developers would disagree with the statement

RE: [OT] Use of Static Methods

2003-07-09 Thread Kris Schneider
> -Original Message----- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 9:22 AM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > > > > > > One of my programmers asked me whether or not it is OK to d

RE: [OT] Use of Static Methods

2003-07-09 Thread Jerry Jalenak
sage- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 12:35 PM To: 'Struts Users Mailing List' Subject: RE: [OT] Use of Static Methods I and a lot of other developers would disagree with the statement "Static methods are evil for many rea

RE: [OT] Use of Static Methods

2003-07-09 Thread Yee, Richard K,,DMDCWEST
raham [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 9:22 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods > > One of my programmers asked me whether or not it is OK to define > helper methods as 'static' - and I realized that I didn't kno

Re: [OT] Use of Static Methods

2003-07-09 Thread David Graham
--- Erik Price <[EMAIL PROTECTED]> wrote: > > > David Graham wrote: > > > Static methods are evil for many reasons including philosophical > (they're > > not OO) and practical (you can't override their behavior). You should > use > > a Singleton class with non-static methods. > > And the gener

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
> > -Original Message- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: July 9, 2003 10:22 AM > To: Struts Users Mailing List > Subject: RE: [OT] Use of Static Methods > > > > > > One of my programmers asked me whether or not it is OK to define

RE: [OT] Use of Static Methods

2003-07-09 Thread Yansheng Lin
:[EMAIL PROTECTED] Sent: July 9, 2003 10:22 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods > > One of my programmers asked me whether or not it is OK to define helper > methods as 'static' - and I realized that I didn't know the answer. So >

Re: [OT] Use of Static Methods

2003-07-09 Thread Erik Price
David Graham wrote: Static methods are evil for many reasons including philosophical (they're not OO) and practical (you can't override their behavior). You should use a Singleton class with non-static methods. And the generally accepted way to get a reference to the singleton is with a static

RE: [OT] Use of Static Methods

2003-07-09 Thread David Graham
> > One of my programmers asked me whether or not it is OK to define helper > methods as 'static' - and I realized that I didn't know the answer. So > I > guess the question is, in a web application, can common code be factored > out > to a helper class and marked as 'static'? Static methods a

RE: [OT] Use of Static Methods

2003-07-09 Thread Yansheng Lin
Depends on what you want to do. 'static' classes are loaded, not instantiated. And you are saying you want to factor out common code and marked as 'static'. I cannot think of any reason not to. Just make sure it's thread-safe. Note there is a difference between Singleton and static. Struts Acti

RE: [OT] Use of Static Methods

2003-07-09 Thread Jerry Jalenak
Singh [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 10:47 AM To: Struts Users Mailing List Subject: RE: [OT] Use of Static Methods There is nothing taboo about writing static methods. They are good in solving purpose. But there is an option -- Singleton. That will keep you safe. As there is

RE: [OT] Use of Static Methods

2003-07-09 Thread Navjot Singh
There is nothing taboo about writing static methods. They are good in solving purpose. But there is an option -- Singleton. That will keep you safe. As there is only 1 object of the class for which you wish to invoke methods. so it's same as calling static methods. (well, syntax is diff ;-) You