Ryan Bates sent this pithy tweet earlier today:
I’ve been toying with DCI lately. But the techniques spelled out to date here and here use Object.extend. Extending an object blows away the method cache, slightly reducing performance.
So, as I lazed in bed, reading this tweet while dreaming of turkey to come, it hits me: instead of implementing the Delegator pattern through extend, let’s just use an actual Delegator object.
Simple example below based on the usage of NewUserProvisioner within RubyPair.
Our good friend SimpleDelegator is defined in “delegate.rb” in stdlib, courtesy of James Edward Gray II.
Posted by evan on Nov 24, 2011