From: "David A. Black" Date: 2007-03-15T11:27:43+09:00 Subject: Re: java guilt Hi -- On 3/14/07, Raj Sahae wrote: > Giles Bowkett wrote: > > I just solved a problem by adding an instance method to String. > > > > It makes for very elegant code elsewhere within the application. > > > > Yet I can't shake the feeling I've done something dirty. > > > > I think there needs to be a group like "Recovering Java Programmers > > Anonymous" or somehting. > > > I've added instance methods to both String and Array. I didn't realize > that I should feel dirty about it. You shouldn't -- you should just be aware of the potential problems. Mainly it's the danger of naming conflicts, if we all start distributing code that adds methods to the core. It's purely a technical issue, though it's often characterized in quasi-moral terms ("great responsibilty") or stigmatized ("monkey-patching"). My observation is that these characterizations are usually a prelude to doing it anyway, even though they don't address the technical problems directly. As soon as someone figures out a way to make it work, all will be well :-) Actually the libraries that allow block-scoped core changes have never been widely used, as far as I can tell. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)