title: Do Objective-C Category names do anything?
body: <p>A class can be extended in Objective C using a category such as:</p>
  
  <pre><code>@interface NSString (CategoryName)
  -(NSString *)myFabulousAddition;  // a fabulous additional method
  @end
  
  /////////////////////////////
  @implementation NSString (CategoryName)
  
  -(NSString *)myFabulousAddition {
      // do something fabulous...
  
  }
  @end
  </code></pre>
  
  <p>In this small example, I would be adding the method <code>myFabulousAddition</code> to NSString. I could then call it by <code>[anNSString myFabulousAddition]</code> just as if it were part of the NSString set of methods. Great and useful.</p>
  
  <p>In the <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocCategories.html">Apple documents regarding Categories</a>, the docs state:</p>
  
  <blockquote>
    <p>There’s no limit to the number of
    categories that you can add to a
    class, but each category name must be
    different, and each should declare and
    define a different set of methods.</p>
  </blockquote>
  
  <p>What if you have something like this:</p>
  
  <pre><code>@interface NSString (CategoryName)
  -(NSString *)myFabulousAddition;  // a fabulous additional method
  @end
  
  @interface NSString (ANOTHERCategoryName)
  -(NSString *)myFabulousAddition;  // a DIFFERENT fabulous additional method 
                                    // BUT with same name as the other category
  @end
  
  
  /////////////////////////////
  
  @implementation NSString (CategoryName)
  
  -(NSString *)myFabulousAddition {
      // do something fabulous...
  
  }
  @end
  @implementation NSString (ANOTHERCategoryName)
  
  -(NSString *)myFabulousAddition {
      // do something equally fabulous, but DIFFERENT...
  
  }
  @end
  </code></pre>
  
  <p>The lack of a name in the parenthesis indicates that the form is an extension to the class, like so:</p>
  
  <pre><code>@interface MyObject ()   // No name -- an extension vs category to MyObject
  - (void)setNumber:(NSNumber *)newNumber;
  @end
  </code></pre>
  
  <p>Does the category name have any meaning to the compiler or linker? Is the category name part of the method signature in anyway or is it part of a primitive namespace? If the category name is meaningless, how do you know if you are about to stomp on another method and get undefined behavior?  </p>