From: "Jörg W Mittag" Date: 2009-01-02T17:11:26+09:00 Subject: Re: What does 'Monkey Patching' exactly Mean in Ruby? Phlip wrote: > Yaser Sulaiman wrote: >> 3- Is the following considered as monkey patching, or is it something else? >> >> class String >> def foo >> "bar" >> end >> end > > No, that is simply extending the class with a new method. Ah, but that's the interesting part: how do you know that somebody else didn't already add a String#foo method? In that case, it *would* be monkey patching. Even worse: which of the two methods would be considered monkey patching and which one wouldn't, would depend entirely on the *load order* of those two snippets of code. That's why I don't think distinguishing between adding and changing methods makes sense: either both are monkey patching or neither are. jwm