From: "David A. Black" Date: 2008-12-28T00:56:57+09:00 Subject: Re: What does 'Monkey Patching' exactly Mean in Ruby? Hi -- On Sun, 28 Dec 2008, Yaser Sulaiman wrote: > According to Wikipedia, a monkey patch[1] is: > >> a way to extend or modify the runtime code of dynamic languages [...] >> without altering the original source code. > > The following statement from the same entry confused me: > >> In Ruby, the term monkey patch was misunderstood to mean any dynamic >> modification to a class and is often used as a synonym for dynamically >> modifying any class at runtime. > > I would like to know the exact meaning of monkey patching in Ruby. There's no exact meaning. Some people use it to mean re-opening core classes; some people use it to mean re-opening core classes in an incompetent, unsafe manner; some people use it as a way of indicating that any time you re-open a core class, you shouldn't (which is a well-intentioned but reductive position); some people use it to mean re-opening non-core classes; and so on. It's basically a negative, uninformative, rather silly term that has nothing going for it. I personally don't use it. I'm a minority of about one, though :-) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)