Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn't that just monkey patching?


http://en.wikipedia.org/wiki/Monkey_patch

By that link's definition, then yeah, it's basically monkey patching.


I think a lot could be said here for maintainability. As others have mentioned, it really goes a long way to take the time and refactor the class to inherit the extra/common functionality if you are working on a team or working on a project that you know will live a very long time. Swizzling will certainly work, but at what cost to readability, debugging and reuse? That's normally the question I ask before swizzling or doing fancy, dynamic things.

Sometimes the quickest or even the most elegant solution isn't necessarily the "best" one. Best being a subjective term, I would say it depends on what you need from your code over time and with whom.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: