Skip navigation.
 
mlRe: Beginner NSAlert question
FROM : David Spooner
DATE : Tue Nov 06 22:50:10 2007

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

> on 11/6/07 10:29 AM, <email_removed> 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

Related mailsAuthorDate
mlRe: Beginner NSAlert question Keary Suska Nov 6, 17:25
mlBeginner NSAlert question Paul Bruneau Nov 6, 17:29
mlRe: Beginner NSAlert question Paul Bruneau Nov 6, 21:40
mlRe: Beginner NSAlert question David Spooner Nov 6, 22:50
mlRe: Beginner NSAlert question Uli Kusterer Nov 6, 23:40
mlRe: Beginner NSAlert question Paul Bruneau Nov 7, 17:14