• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subclass of NSMutableDictionary hanging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclass of NSMutableDictionary hanging


  • Subject: Re: Subclass of NSMutableDictionary hanging
  • From: Nick Forge <email@hidden>
  • Date: Sun, 4 Mar 2007 16:11:40 +1100

Ok, that's cool. I can live that - it's no big deal to simply "wrap" every time I want to subclass those objects.


On 04/03/2007, at 3:53 PM, Jerry Krinock wrote:

on 07/03/03 19:10, Nick Forge at email@hidden wrote:

OK, so it seems like you can't (simply) subclass some NSxxx data objects...
why is that? I have successfully subclassed some GUI NSxxx objects with no
problems.


In this situation I can very easily just have my own object wrapper that
contains and maintains an nsdictionary - but I'm still interested as to why
normal subclassing doesn't work like it does in other OO languages. From
reading this page:


http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/Co
coaObjects/chapter_3_section_9.html


I am pretty lost as to why you have to add all of the seemingly redundant
"glue code" for all of the primitive methods. Can you just write all of the
primitive methods as:


- (void)someMethod:(NSObject *)x
{
[super someMethod:x];
}

Or am I missing something? {scratches head...}

Nick, I don't know any more than you do about this, except that if you
search the list archives (cocoabuilder.com), going back five years or so,
you'll see some long threads with people bitching about how Apple maybe
"bent the rules" or "violated object-oriented design axioms" with their
collection classes. I believe the short answer to your first question is
"because NextStep/Apple says so in their documentation" and a slightly
longer answer is "because they compromised strict OO design, probably for
expediency, in designing their collection classes". The advice I've always
been given is: simply Do Not Subclass NSMutableDictionary. As I and others
have told you, there are better alternatives anyhow. As to your second
question about over-riding primitive methods, I don't really know since I
haven't read that document you're referring to.


Jerry



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: Subclass of NSMutableDictionary hanging
      • From: mmalc crawford <email@hidden>
  • Prev by Date: Notifications
  • Next by Date: Connections between a text field and an instance variable do not work
  • Previous by thread: Re: Subclass of NSMutableDictionary hanging
  • Next by thread: Re: Subclass of NSMutableDictionary hanging
  • Index(es):
    • Date
    • Thread