<pedantic> Class methods cannot be overridden, they can be hidden. It's a compile-time error for a class method to hide an instance method. </pedantic>
Quoting "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]>: > I and a lot of other developers would disagree with the statement > "Static methods are evil for many reasons including philosophical (they're > not OO) and practical (you can't override their behavior)." > > 1) Whenever you write a method that only accesses static data of a class, > you should declare the method as static. > > 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, however. > > 3) There are many cases where using the static modifier on a method is > totally appropriate. Typically, they are used on methods that provide a > very > specific functionality that will never change. Using the static modifier on > such methods also reduces the overall memory footprint of an application. > > 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 > > > > > > 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 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. > > Struts' RequestUtils class is a good example of why you should never use > static methods. Developers want to override their behavior but can't > because everything is static. > > David > > > Are there any major problems > > with > > doing this? I should know the answer, but just can't put my thumb on > > it right now.... 8) > > > > TIA! > > > > Jerry Jalenak > > Team Lead, Web Publishing > > LabOne, Inc. > > 10101 Renner Blvd. > > Lenexa, KS 66219 > > (913) 577-1496 > > > > [EMAIL PROTECTED] -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

