DISQUS

DISQUS Hello! Virtuous Code is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Announcing Ninja-Patching!

Started by avdi · 10 months ago

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 ... Continue reading »

10 comments

  • I suppose this was meant as a joke, but I intend to use "Ninja-Patching" from now on instead of that other phrase, the one actually invented by Python programmers."
  • "I suppose this was meant as a joke"

    LOOK AT THE DATE MAN!!!!!!!!!!
  • But i must agree somewhat :-)

    I think whenever someone mentions monkey patching from now on, I will refer to ninja patching. Sounds a lot better.
  • "I intend to use “Ninja-Patching” from now on instead of that other phrase"

    I personally favor "slapmethoding", which is entry #3 in _why's Complete List Of Substitute Names For The Maneuver We Now Know To Be Monkeypatching.

    http://hackety.org/2007/08/10/myCompleteListOfS...
  • Being a Python developer, I have no strong feelings either way on this post, but I like your writing style!
  • class ChosenOne
    Thread.new do
    while(Module.constants.grep(/Ninja/).empty?)
    sleep(1)
    end
    Ninja.class_eval do
    private
    def attack!
    # Ahah! The ninja is helpless!
    end
    end
    end
    end

    My apologies, I'm still new to Ruby so I'm sure this could be nicer. I couldn't figure out a decent way to determine if a class is defined (it must be staring me right in the face), and the thread was the only way I could get it to work regardless of the require ordering.

    Needless to say I enjoyed this post!

    One other thing: I lost my comment the first time I submitted because I was prompted about OpenID. I am not a fan of that behaviour :/
  • Paul: sorry about the lost comment. I'm increasingly not a fan of WordPress, period.
  • That is really cool!

    I had to laugh out loud while trying it out and understanding it!

    "Objects, silence! Beware of the Ninja!"
  • A python, a monkey, and a ninja walk into a bar.. LOL
  • nice job, thanks for this useful article

Add New Comment

Returning? Login