On Jul 15, 2008, at 9:13 AM, John Love wrote:
To tell you the truth, I *really* prefer calling a category an extension
because "extension" just sounds more meaningful to me.  Or, maybe just
plain, ole, generic "addition". "Category" just sounds like "type of" or a
sub-class, but it's not that at all.

Yes, we're discussing words, but words are important .. Look up "category" in a dictionary where it talks about classification. To me, classification
means sub-class.

The normal English meaning of "category" applies to the methods, not the object. For example, a controller class might have a bunch of accessor methods and a bunch of action methods. I think of each of those bunches as categories of methods. When you extend a class with a "category" in the Objective-C sense, you're typically creating a logical "bunch." You typically use a logical name for the bunch as the name of your category.

Grepping for category declarations in, say, Foundation shows how category names identify logical grouping of methods:

% cd /System/Library/Frameworks/Foundation.framework/Headers
% grep @interface *.h | grep "("
NSArchiver.h:@interface NSObject (NSArchiverCallback)
NSArray.h:@interface NSArray (NSExtendedArray)
NSArray.h:@interface NSArray (NSArrayCreation)
NSArray.h:@interface NSMutableArray (NSExtendedMutableArray)
NSArray.h:@interface NSMutableArray (NSMutableArrayCreation)
NSAttributedString.h:@interface NSAttributedString (NSExtendedAttributedString) NSAttributedString.h:@interface NSMutableAttributedString (NSExtendedMutableAttributedString)
NSCalendarDate.h:@interface NSDate (NSCalendarDateExtras)
NSCalendarDate.h:@interface NSDate (NSNaturalLangage)
...(a hundred or so more)...

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to