From: dblack@... Date: 2006-07-19T04:05:40+09:00 Subject: Re: Preferred monkeypatching technique Hi -- On Wed, 19 Jul 2006, Tom Werner wrote: > James Britt wrote: >> Hal Fulton wrote: >>> dblack@wobblini.net wrote: >>> >>>> >>>> I don't know whether it qualifies as "monkeypatching" (I always >>>> thought that meant doing something sloppy and ill-advised, which I >>>> hope I'm not :-) but see if this helps: >>> >>> >>> Actually it was only last week that I first saw this term >>> being used in the Ruby community. I wonder if it's too >>> late to squash it? >> >> Let's hope not. >> >> I believe it comes from the Python community. Python (I think) allows for >> something similar to Ruby's ability to modify any and all classes, but my >> (limited) understanding is that there are enough differences between the >> two that what is reasonable and proper in Ruby is not quite so elegant or >> appropriate in Python. The term may be correct for Python, but in Ruby >> this is just a normal and correct way to use the language. >> >> >> The use of the term indicates unease with, and lack of understanding of, >> Ruby on the part of the speaker, rather than describing anything about >> Ruby. >> > Not necessarily. For me, the term "monkeypatch" establishes a distinction > between a patch that adds functionality in a totally benign way, and a patch > that changes the behavior of existing functionality using (meta)programming > techniques. Because a monkeypatch, if not carefully considered, can put the > main codebase into a state that causes other monkeypatches to be buggy (or > worse), it is useful to be able to put a finger on the technique and teach > the best practices that go along with it. Perhaps the term "monkeypatch" has > bad connotations for some, but it seems to be undergoing a reclamation (for > instance, the wikipedia entry does not have a negative connotation). For > Pythonistas, monkeypatching may be ill advised; for Rubyists it is normal, > but can cause such side effects as to be quite dangerous. By naming it, we > can better control it. How about we call the whole thing "programming", and at the same time do whatever we can to bring it about that people do this "programming" thing as intelligently and safely as possible? :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy http://www.manning.com/black => RUBY FOR RAILS (reviewed on Slashdot, 7/12/2006!) http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log dblack@wobblini.net => me