Re: Categories (was Re: Cocoa et al as HCI usability problem)
Re: Categories (was Re: Cocoa et al as HCI usability problem)
- Subject: Re: Categories (was Re: Cocoa et al as HCI usability problem)
- From: Georg Tuparev <email@hidden>
- Date: Mon, 02 Jun 2008 22:31:03 +0200
On May 20, 2008, at 10:46 AM, Bill Bumgarner wrote:
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
I am late with my comment - sorry.
I studied in the oldest german university - Heidelberg. During the
long history of the town there were three or four major fires that
burned almost all houses. Still, about 1000 years after the first of
these fires the parents were teaching their kids how to handle the
matches. Why? Because people learned to take calculated risks - if the
potential benefits are bigger then the dangers.
Granted, compared with you I am a real greenhorn - I start programming
my NeXT pizza box in 1991. Nevertheless, I can say that the ability to
override existing functionality in categories saved me a lot of coding
- although, or perhaps because, it is damned dangerous, and therefore
powerful. And I do not know a developer with several years of Cocoa-
related coding under the belt who did not used this at least to fix
bugs created by someone else. And this is not the only application...
cheers
Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196
_______________________________________________
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