Menu Sidebar


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 ultimately, that is what this line of code says to me about Ruby. It says […]

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 he or she wises up and greps through the codebase, discovers where you re-opened the […]

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”:, we used the following code to accumulate packets until an ending packet was found:

We test whether the packet denotes the end of a message by searching for the token @”ENDENDEND”@. This […]

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 hypothetical communications protocol, Flying Monkey Transport Protocol (FMTP). Flying Monkey Transport Protocol is a packet-based […]

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”:[]! *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 it to a publicly available gem! As anyone who read past the title of my […]

Older Posts

Virtuous Code

"The three virtues of a programmer: laziness, impatience, and hubris" — Larry Wall

Books and Screencasts

RubyTapas Screencasts

RubyTapas Screencasts

Small plates of gourmet Ruby code.

Confident Ruby

Confident Ruby cover

32 Patterns for joyful coding.

The Making of

Confident Ruby cover

Watch me build an app in Sinatra and Rails

Objects on Rails

Objects on Rails

A developer notebook on applying classic Object-Oriented principles to Ruby on Rails projects.

Exceptional Ruby

Exceptional Ruby

The definitive guide to exceptions and failure handling in Ruby.