Questions tagged [monkey-patch]
6 questions
16
votes
5 answers
Is monkeypatching considered good programming practice?
I've been under impression, that monkeypatching is more in quick and dirty hack category, rather than standard, good programming practice. While I'd used from time to time to fix minor issues with 3rd party libs, I considered it temporary fix and…

vartec
- 20,760
- 1
- 52
- 98
3
votes
3 answers
Is this a good use of monkey patching?
I have a set of data-struct like classes that correspond to the JSON messages being exchanged between services in an overall architecture. By struct like, I mean these classes just have fields -- no member functions -- and are implemented using…

Dave
- 262
- 1
- 8
0
votes
2 answers
What is the best practice for temporarily pairing an attribute with a class
Consider a case, in which a class needs an attribute only in a very limited context. (For example, only during initialization, which is handled by a factory) I do not want to include such an attribute in the class, in order to keep it as simple as…

Ali Rasim Kocal
- 992
- 1
- 6
- 11
0
votes
1 answer
Add method to existing class you don't own in javascript
Is it still called monkey patching if you are only adding new methods instead of changing existing method behavior? What is this called?
Example:
String.prototype.contains = function(needle) { return false; }
That may not be the best example, but…

still_dreaming_1
- 261
- 1
- 13
-1
votes
1 answer
Is there a purely technical term for 'monkey patching'
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. …

kostja
- 419
- 4
- 13
-1
votes
1 answer
Code design: is this specific case of monkeypatching in python acceptable?
I'm using python to do some research tasks. I have a class hierarchy for "tools", where each object is an instance of a particular tool. They all share some functionality and have many similarities in their states.
Some of these tools can use one of…

Greg Kramida
- 282
- 2
- 12