• 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: EOF and the Observer Pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOF and the Observer Pattern


  • Subject: Re: EOF and the Observer Pattern
  • From: Ken Anderson <email@hidden>
  • Date: Thu, 30 Oct 2008 21:14:27 -0400

Since it's not likely that all objects that you need to update are in the EC, I wouldn't depend on any observer paradigms.

When I have dependency situations like that, I usually update them in my 'finalize' set of methods. My base EO has 3 methods:

finalizeForInsert
finalizeForUpdate
finalizeForDelete

My editing context subclass iterates all EOs to be saved and sends the appropriate methods. Since I'm OK with the idea of modifying data in these methods and/or adding new objects, I keep track of all the objects that have already been sent finalize and loop until all objects have had the method called. I'm pretty sure Chuck and Sacha has a similar structure in their book.

Anyway, I override these methods in subclasses that need to know when something changed, and do "the right thing". If the objects that you need to update aren't in memory, you load/fault them. The nice thing with this methodology is, everything gets saved in the same commit, so either everything makes it, or nothing does.

Ken

On Oct 30, 2008, at 3:04 PM, Andrew Lindesay wrote:

Hello David;

I use the 'ObjectsChangedInEditingContextNotification' in sub- entities to update the modifiedTimestamp in major-entities. This works really well for me.

cheers.

I have several places in my application where a large number of EOs exist in the DB that are directly dependent upon other EOs. If the depended-upon EOs change, then all the dependent EOs may need to be updated.

___ Andrew Lindesay www.lindesay.co.nz

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: EOF and the Observer Pattern
      • From: Chuck Hill <email@hidden>
    • Re: EOF and the Observer Pattern
      • From: Andrew Lindesay <email@hidden>
References: 
 >EOF and the Observer Pattern (From: David Avendasora <email@hidden>)
 >Re: EOF and the Observer Pattern (From: Andrew Lindesay <email@hidden>)

  • Prev by Date: Re: awake() called twice on page refresh
  • Next by Date: Re: EOF and the Observer Pattern
  • Previous by thread: Re: EOF and the Observer Pattern
  • Next by thread: Re: EOF and the Observer Pattern
  • Index(es):
    • Date
    • Thread