Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
- Subject: Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
- From: Jens Alfke <email@hidden>
- Date: Sat, 10 May 2008 21:41:57 -0700
On 10 May '08, at 6:53 PM, Chris Hanson wrote:
Not necessarily. You can simply return a constant YES for a read-
only "dirty" property, and treat the property-change itself as the
trigger you care about.
A "dirty" property that tells lies half the time doesn't sound like a
good idea to me... o_O
If listening for a property change is the only way to tell if an
object's dirty, that means that only objects that have been around as
long as the target object, and registered as listeners when the target
was first created, can reliably tell if it's dirty. (And they'd have
to implement their own flag to remember this state, if they didn't
want to act on it immediately...)
Worse, KVO sends out a lot of false-alarm property change
notifications. Calling -setUUID: and passing in the original UUID (or
an equal string) will trigger a notification, even though the property
value hasn't changed. You really don't want that to mark the object as
dirty, if that results in as much work as an UPDATE to a database row.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden