From: David Vallner Date: 2006-01-10T19:43:27+09:00 Subject: Re: global variables are bad?? Lyndon Samson wrote: >Playing Devils Advocate for the sake of the discussion, a quote from MF :-) >http://www.martinfowler.com/bliki/DuckInterface.html > >"Another factor is what the language encourages for implementing these >structures. As Charles >Millersaid >"Java's design >*affords* small interfaces, and utility functions provided as static methods >on helper classes. Ruby's design affords larger classes with mixed-in >utility methods." > > Static methods on helper classes? Eww... Lawks, you call those global functions, dearie ;P Java is consistent it not being "magic" at any time, and keeping to a very minimal set of well known basic language principles with the good and the bad that brings - the good being it's easy to grok, the bad the severe lack of flexibility there is for consistency's sake. Then one reason people use the kludgy static methods is because it's usually less typing than properly adding instance methods to your code - laziness is a big motivator of the efforts of man ;) The other one I can think of is being unable to extend existing classes within Java, but should AspectJ and the like ever get to / already have the dark voodoo of weaving introduction aspects directly into bytecode at startup time, you can arguably do that using some rather trivial AOP if you swing that way. "The language made me do it" is NOT an excuse for bad design. David Vallner .NET bashing for fun and profit (Because SortedLists are IDictionaries now)