Categories (was Re: Cocoa et al as HCI usability problem)
Categories (was Re: Cocoa et al as HCI usability problem)
- Subject: Categories (was Re: Cocoa et al as HCI usability problem)
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 20 May 2008 01:46:29 -0700
On May 20, 2008, at 1:07 AM, Peter Duniho wrote:
But personally, it makes me nervous to have a language that allows
the implementation of a class to change according to other code not
related to the class. It's one thing if you're just adding a method
that you want to use somewhere else. But in Objective-C you can
also add a method that overrides a base class method, or would not
normally exist in the class but which has meaning to some other code
that might check for it.
I have been programming in Obj-C against the Cocoa APIs (and their
predecessors) since 1989-- with quite a few other random APIs and
environments over the years, too-- and I can unequivocally say that
the ability to override existing functionality in categories is just
damned dangerous.
When I found out about C#'s "extension methods", I wrote about it here:
http://www.friday.com/bbum/2007/01/31/c-30-now-with-categories/
And then followed up with a second post here:
http://www.friday.com/bbum/2007/02/02/c-30-categories-followup/
In any case, you are absolutely correct that categories are dangerous
and the above includes an anecdote documenting a particularly
egregious related problem. Most extremely powerful tools are.
Sometimes one must question whether or not said power is gratuitous or
truly useful and this particular feature falls in "gratuitous".
Reminds me of this classic story:
http://artlung.com/smorgasborg/C_R_Y_P_T_O_N_O_M_I_C_O_N.shtml
In particular, search for "hole hawg".
Given that the Cocoa development community has obviously expanded
quite substantially in recent months and many of you are coming to
Cocoa with deep experience in other environments and languages, please
file bugs / feature requests / feedback through Apple's bugreporter
system (http://bugreport.apple.com/).
thanks,
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden