DISQUS

Virtuous Code: Announcing Ninja-Patching!

  • Reg Braithwaite · 1 year ago
    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."
  • she · 1 year ago
    "I suppose this was meant as a joke"

    LOOK AT THE DATE MAN!!!!!!!!!!
  • she · 1 year ago
    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.
  • nicholas a. evans · 1 year ago
    "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...
  • Poromenos · 1 year ago
    Being a Python developer, I have no strong feelings either way on this post, but I like your writing style!
  • Paul Batum · 1 year ago
    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 :/
  • avdi · 1 year ago
    Paul: sorry about the lost comment. I'm increasingly not a fan of WordPress, period.
  • Soleone · 1 year ago
    That is really cool!

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

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