Tag Archives: monkeypatching

Phenomenal Cosmic Power

Jeff Atwood thinks monkeypatching should frighten you: But if wielding that power doesn’t scare and humble you a little, too, then maybe you should leave the monkeypatching to the really smart monkeys. Reg Braithwaite thinks it should exhilarate you: And … Continue reading

Posted in Uncategorized | Tagged | 7 Comments

Announcing Ninja-Patching!

Sure, monkey patching is great and all. That period of disbelief, followed by increasing exasperation as the victim maintenance programmer discovers that an object is behaving differently than it’s source code says it should, is satisfying. But sooner or later … Continue reading

Posted in Uncategorized | Tagged , , , | 23 Comments

Sustainable Development in Ruby, Part 2: Method Injection

Sometimes you have a need for an object method which the class author did not foresee. For instance, in our “previous installment”:http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/, we used the following code to accumulate packets until an ending packet was found: class BufferedConnection < FMTP::Connection … Continue reading

Posted in Uncategorized | Tagged , , , | 10 Comments

Sustainable Development in Ruby, Part 1: Good Old-Fashioned Inheritance

The first technique we’ll look at in this series is something so basic it may not even seem worth spelling out. But sometimes old-school techniques are overlooked in the excitement of a young language. Let’s use as our example a … Continue reading

Posted in Ruby | Tagged , , , | 20 Comments

Full Disclosure; or, What’s in your toolbox?

The one objection I _haven’t_ heard yet to my monkey patching rant is: you’re a “hypocrite”:[http://utilitybelt.rubyforge.org/svn/lib/utility_belt/convertable_to_file.rb]! *Gasp*, yes, I have written code that exploits Ruby’s open classes. It even extends @Object@, the core-est of the core! And then shamelessly contributed … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Followup to “Monkeypatching is Destroying Ruby”

My last article was intentionally provocative, and my expectations of response were exceeded. The “ruby-talk thread”:http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/292269?292062-292516 was full of good comments. I’m appreciative of everyone who has taken the time to respond either there or here on the blog. I … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Monkeypatching is Destroying Ruby

(The title of this post is intended to be deliberately provocative, as well as being a nod to Steven Colbert’s “The People Destroying America” segments. It’s provocative because I want to get people talking about this issue.  I don’t actually … Continue reading

Posted in Uncategorized | Tagged , , , , , | 47 Comments