[EMAIL PROTECTED] wrote: > I've seen the anti-helper class/anti-static meme pop up every once in > awhile. And now it's raging where I work. The argument seems to boil > down to "static methods aren't OO." Given all the attention that > functional languages has gotten, I had thought most people had moved > on from trying to fit everything into a pure OO model. IMO a static > method is simply a functional construct and there are times where it's > the simplest, cleanest way to deal with a problem (e.g. the methods in > Apache Commons StringUtil class: > http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html). > > So I'm curious, what is the latest thinking on this subject? Anyone > have any best practices around when to use a static method and when > not to?
Easy: The rule: + No static methods in non-helper classes. + No non-static methods in helper classes. The exception: + Merge helper and helpee into one class when sensible to do so. Any questions? -- Weiqi Gao [EMAIL PROTECTED] http://www.weiqigao.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
