• 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: exception in class derived from NSMutableDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exception in class derived from NSMutableDictionary


  • Subject: Re: exception in class derived from NSMutableDictionary
  • From: Robert G Palmer Jr <email@hidden>
  • Date: Wed, 30 Jul 2003 14:03:56 -0400

I guess it's a grey area. I have a collection of sensors. If I say it is a "has-a" relationship, then I'll be writing pass through methods for every dictionary call I want - except the two special ones I have shown. The pass through methods won't do anything special, just call the super class. That's what got me to thinking it is really an "is-a" relationship. I originally wrote it as a "has-a" relationship.

One advantage to the "has-a" relationship, which is probably a good argument to going back "has-a" is that it hides the implementation. However, from the user's perspective, each item in the collection is accessed via the MAC address as the key, which points back to "is-a" because that approach to accessing (using the MAC as a key) implies a dictionary.

I chose "is-a" because it saves writing code.

Comments and suggestions openly appreciated.

Thanks for all the info and pointers.

Robert Palmer, Jr
email@hidden

On Wednesday, July 30, 2003, at 01:48 PM, Dylan Adams wrote:


Are you sure this isn't a has-a relationship instead of an is-a relationship? That is, could your class VideoSensorCollection just
have an NSMutableDictionary instance variable that you then cover
with some add and remove methods instead of subclassing?

I agree.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: exception in class derived from NSMutableDictionary
      • From: Chris Hanson <email@hidden>
    • Re: exception in class derived from NSMutableDictionary
      • From: Sherm Pendley <email@hidden>
References: 
 >Re: exception in class derived from NSMutableDictionary (From: Dylan Adams <email@hidden>)

  • Prev by Date: Re: exception in class derived from NSMutableDictionary
  • Next by Date: Re: Repost: NSTableView headaches (please help!)
  • Previous by thread: Re: exception in class derived from NSMutableDictionary
  • Next by thread: Re: exception in class derived from NSMutableDictionary
  • Index(es):
    • Date
    • Thread