Re: Beginner NSAlert question
Re: Beginner NSAlert question
- Subject: Re: Beginner NSAlert question
- From: David Spooner <email@hidden>
- Date: Tue, 6 Nov 2007 14:50:10 -0700
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.
Cheers,
dave
_______________________________________________
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