Paul Winkler <pw_lists@slinkp.com> wrote:
On Wed, Feb 23, 2005 at 06:22:30PM +0100, Florent Guillaume wrote:
There's usually no problem with using refresh and monkey-patching.
Only badly written products that monkey patch by first unconditonnaly saving the old version of a function/method, then replacing it with some new one that does stuff and then calls the old one, may fail.
That's probably what I saw.
Aside from refresh, are there other reasons you consider that technique bad? I've often used it as a sort of in-place decorator.
The obvious alternative is to copy/paste the code from the original method. Is that what you prefer?
It depends, sometimes I have no other option than modifying a copy/pasted method because it's big and the change I have to do is in the middle of it. Copy/pasting is also bad if you expect the 'original' method to change over time, so you'll get de-synced. Most of the time I prefer to do my stuff and call the original one (before or after). For small methods where's there's no risk of version drift though I just copy/paste them and change them. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com