Pregunta

EDIT The original title of the question was Is there a non-derogatory term for 'monkey patching'. As I have learned that the term is actually not derogatory, or is at least not meant to be, I changed the name to free it from mistaken implications.


I would like to describe a piece of software, and try not to use emotionally biased language. However I am not aware of an unbiased alternative to 'monkey patching'.

The term is meant to be derogatory for a reason. Many see it as a useful but problematic technique.

I am aware of an alternative, but it is equally derogatory: 'duck punching'.

I see 'open classes' not as an alternative name, but as a prerequisite for monkey patching.

'Overriding' does not seem right either. I would like to differentiate between monkey patching and the regular overriding as part of inheritance-based polymorphism.

¿Fue útil?

Solución

As someone who was actually working at Zope Corporation (then still called Digital Creations) when the term came into being, I can emphatically state it is very much not derogatory.

The term is a tongue-in-cheek reference to runtime patching (or dynamic patching, if you will).

We talked about sneaking in and altering Python code at runtime; the term Guerrilla Patching was used because sometimes dynamic patches could interfere and conflict. Conflict -> Guerrilla warfare, as the conflict was dynamic and depended on the terrain.

Then someone who had misheard the term and thought it was Gorrilla Patching, had come up with a way to wrap a method and re-use it in their dynamic patch. This meant that even if the method had already been patched, you would not undo that work. Because this was a gentler, more caring form of patching, he used the name Monkey Patch instead. The name stuck as it spread through the wider Python community.

If you feel you cannot use terms like that because they have too many other connotations for you, then so be it.

The technical, colorless and humorless version you are looking for is dynamic runtime patching.

Licenciado bajo: CC-BY-SA con atribución
scroll top