• 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
MVC question about updating the Model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MVC question about updating the Model


  • Subject: MVC question about updating the Model
  • From: Matt DeFoor <email@hidden>
  • Date: Fri, 16 Apr 2010 09:30:44 -0400

I'm having a problem deciding on how a Model object should be updated.

I have multiple resource objects that are represented in an
NSOutlineView. These resource objects can be updated by their own
triggered timer or potentially on demand by the user via the View (a
button is clicked in the UI).

At first, I thought that the resource object should have the
capability to update itself. Therefore, the resource has a method like
so:

[resource update];

If the resource's timer fires, it calls it's update method like so:

[self update];

If the resource update button is clicked by the user, the selected
resource item is updated by the NSWindowController with:

[resource update];

This is where I'm having difficulty determining what should be
standard practice. Would it be better to post a notification that
indicates the resource should update itself? Or is it good enough to
leave it as is?

One other approach I've considered is whether the Model should have
the ability to update itself at all. Should the controller be
responsible for updating the resource always?

It seems that either approach is viable, but which is better?

-Matt
_______________________________________________

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

  • Follow-Ups:
    • Re: MVC question about updating the Model
      • From: Quincey Morris <email@hidden>
    • Re: MVC question about updating the Model
      • From: Graham Cox <email@hidden>
    • Re: MVC question about updating the Model
      • From: Joanna Carter <email@hidden>
  • Prev by Date: Re: How to empty the Trash programmatically?
  • Next by Date: Re: MVC question about updating the Model
  • Previous by thread: Re: How to empty the Trash programmatically?
  • Next by thread: Re: MVC question about updating the Model
  • Index(es):
    • Date
    • Thread