3 ms·
Monkey patching is something that you should know how to do. And then learn not to do. Monkey patching is how you get into situations where the order in which
by btilly 9y ago
Monkey patching is something that you should know how to do. And then learn not to do.
Monkey patching is how you get into situations where the order in which libraries get loaded causes software to unpredictably work or break. Or, worse yet, to work reliably on the developer's machine and break in the wild. (Because the external library on someone else's server loads slower for the developer than their local library, and faster for some users.)
- Waterluvian 9y agoNever say never. I saved hours on proof of concept code that dies in weeks. I think you learn when not to do it, which is most of the time.
- RcouF1uZ4gsC 9y ago> dies in weeks. Code can end up living a lot longer than people think it will (see Y2K bug).
- dingo_bat 9y agoAlso I've seen managers pushing people to use prototype code directly for the production app, because "why fix what's not broken" and "we need this last week". So I write my prototypes as if they are going to be shipped.
- rrcaptain 9y ago>see Y2K bug One of my biggest pet-peeves is how since popular media hyped Y2K up as a potential world ending disaster when nothing happened people thought the whole thing was a myth. When it was not a myth (though it was overblown), it was just avoided because people engineered around it. I can't wait to see how people handle the Year 2038 Problem.
- dagw 9y agoI'm embarrassed to think about how many of my quick hack proof of concepts are still running years later.
- Baeocystin 9y agoNothing is more permanent than a temporary solution.
- singingfish 9y agos/most of the time/(?:almost )?all of the time/ Things I've been reading about python recently makes it seem to me like python people are re-learning lessons from perl.
- ehsankia 9y agoWhile actually using it in live code is definitely a bad idea, I'll have to say, it makes debugging and prototyping a lot easier and doable interactively.
- hueving 9y agoMeh, all of these caveats apply to module level vars vs instance vars. Monkey patching can be quite effective if you're careful.
- a1815 9y agoWhat's the best practice to land a change on a library without monkey patching or self hosting the library?
- applecrazy 9y agoSend in a pull request on their repo, or publish an issue and beg the maintainer to support your use case.