News for hackers. Stuff that matters.
Re:Objective-C isn't what you think it is by bennyg on Wednesday February 26, 2014 @02:47PM (#7307173)
Re:Objective-C isn't what you think it is by babesh on Wednesday February 26, 2014 @02:48PM (#7307178)
Was addressing the use of categories to override not method swizzling per se.

Oh, I read your link. So you add more behavior to it, not override it completely.

Re:Objective-C isn't what you think it is by seanmcdirmid on Wednesday February 26, 2014 @02:56PM (#7307236)
Isn't that just monkey patching?
Re:Objective-C isn't what you think it is by bennyg on Wednesday February 26, 2014 @03:07PM (#7307303)
http://en.wikipedia.org/wiki/Monkey_patch

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

Re:Objective-C isn't what you think it is by my3681 on Wednesday February 26, 2014 @06:06PM (#7308891)
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.