Re: Notification redundancy
Re: Notification redundancy
- Subject: Re: Notification redundancy
- From: Allan Odgaard <email@hidden>
- Date: Thu, 29 Jan 2004 14:25:23 +0100
On 28. Jan 2004, at 16:09, Erez Anzel wrote:
I have enjoyed using the notification system built into Cocoa. But the
standard approach may not be the wisest in my situation, where I may
have tens of thousands of objects sending notifications, and multiple
observers.
You may reduce it by using NSIndexSet -- but that would be more or less
the same as letting the action method send the notify.
In a case like this, it's more efficient for the action method to post
the notification, instead of each object. I could make a decision at
runtime as to whether the action posts the notification, or each
object, depending upon how many objects are involved. But this starts
to get messy; I have many different actions, many object types, and
many "set" methods for each.
Any wisdom on this issue?
You could let the objects add info about what they did to their
container and let the container send the notify, then, if anybody wants
to know exactly what happend, they would query the sender of the
notification.
But do all these 50,000 objects really need to be NSObject subclasses?
i.e. do they need any of the advantages that comes with being an object
(run-time polymorph method invocation, inheritance etc.), or are they
just simple points, to which you have added some action methods (which
could just as well be "global" functions)?
--
http://www.top-house.dk/~aae0030/
_______________________________________________
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.