On Sat, Feb 23, 2008 at 10:07 PM, Avdi Grimm <avdi / avdi.org> wrote: > Hi folks, > > I wrote a blog post with the intentionally provocative title above, > which can be found here: > > http://avdi.org/devblog/?p=18 > > While the title is a bit of deliberate hyperbole, I am genuinely > troubled about the popularization of monkey patching in the Ruby > community. I explain my reasons more thoroughly in the post, but > here's a synopsis: > > Monkeypatching has become the hip thing to do in the > Ruby and (especially?) Rails communities, and it has > reached the point where experienced programmers are > turning to it as the tool of first resort *even* when there > is a simpler, more traditional solution available. I > suggest that it's time for Ruby hackers to start setting a > better example. > > My hope with this post is to start a conversation about fostering > robust software extension mechanisms in the Ruby ecosystem. I welcome > any comments, both here and on the blog. > > -- > Avdi > > P.S. Before anyone accuses me of it, yes, this is a kind of > self-promotion. But I really do want to start a conversation about > this, and no one reads my blog. > > I really think that your BLOG entry is a bad way to say something intelligent, AMOF you say many intelligent things. It would make so much more sense to explain aspects of the technique you do not like, I see the following issues: Lots of people seem to confuse Runtime class modification (metaprogramming) with MP. There are very important issues to be discussed about if MP is on core classes or commonly used packages and most importantly if you MP in a package or in an application. I have the feeling that you were making *very valid* points but they do not concern MP in at least 50% of their use cases. (or maybe those I use). As others have said it somehow boils down to bad code vs. good code and thats why I would have appreciated some examples of everyday code. It is obvious that doing things like class Array def size; 0 end end in a library or an application is nonsense. OTOH class Array def to_hash Hash[*self.flatten] end end might just make an application much more readable, but I still would think twice of putting it into a library. If I do so (putting it into a library ) another point you have been talking about becomes important, convention, documentation. Your Blog post could be a series of very interesting posts but you are throwing years of experience and reflexion at us in one single post. Have mercy with us ! But do not fear I am working on a programming language that will not allow for bad code anymore, first release is scheduled for stardate 4242.42 ;) Cheers Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein