Design Element
Comment on "Class Variables and Categories"
by David Young — Nov 29
Yeah, I kinda don't understand these Google Mac blog posts in which they say that doing something absolutely crazy (and usually nasty) is a must-know for either performance and/or safety when Cocoa programming. What's up with that? I'm all for performance analysis and new GCC features, but the conclusions they arrive at baffle me.

There is evidence that they are abusing categories. Not only is it true that if you have two +initialize's in two categories, behavior is indeterminate, but the same is true of any two base or category methods on the same class whose selectors collide. Categories are not meant for overriding methods, but for extending base classes, which is why you see so many categories namespaced, e.g., _web_safeMakeObjectsPerformSelector:. I'm sure you know this, but since they've got comments turned off over there, it's not as though the topics are open for discussion, which somewhat irks me.

(n.b., based on their previous article, one thing I'm sure they want is thread safety, which is omitted from the above.)
Back to "Class Variables and Categories"
Design Element

Copyright © Scott Stevenson 2004-2015