• 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: Beginner NSAlert question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner NSAlert question


  • Subject: Re: Beginner NSAlert question
  • From: Paul Bruneau <email@hidden>
  • Date: Wed, 7 Nov 2007 11:14:35 -0500

On Nov 6, 2007, at 4:50 PM, David Spooner wrote:

On 6-Nov-07, at 9:25 AM, Keary Suska wrote:

on 11/6/07 10:29 AM, email@hidden purportedly said:

In the middle of this -complete code, an alert might be required. Do
I put the alert code in the orderStep class, or in the controller
class?

This may be a gray area of MVC, but I don't see a problem assuming that the
NSAlert class is the controller class in this situation, and the model is
simply asking the controller to prompt for information.

In my opinion, a model object should have no knowledge of any associated controller(s). Any information required by a model's manipulation methods should be either supplied as arguments, available through a delegate, or implicit in the model itself. It is the controller's responsibility to prompt for such information where necessary. The only communication from model to controller should occur through key/value observation. This discipline is particularly useful when providing multiple views of a model.


I would regard a situation where a model method does not have sufficient information as exceptional; the controller which invoked the method can present an alert sheet in response to caught exceptions.

This is probably my biggest struggle in cocoa programming. Controllery things keep sneaking into my models. I will keep your message around to beat against my head until I internalize it. Thank you.
_______________________________________________


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


References: 
 >Re: Beginner NSAlert question (From: Keary Suska <email@hidden>)
 >Re: Beginner NSAlert question (From: David Spooner <email@hidden>)

  • Prev by Date: Re: Enabling cut and paste in modal window
  • Next by Date: NSView begin scrolled
  • Previous by thread: Re: Beginner NSAlert question
  • Next by thread: Re: Beginner NSAlert question
  • Index(es):
    • Date
    • Thread