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
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 mails | Author | Date |
|---|---|---|
| Keary Suska | Nov 6, 17:25 | |
| Paul Bruneau | Nov 6, 17:29 | |
| Paul Bruneau | Nov 6, 21:40 | |
| David Spooner | Nov 6, 22:50 | |
| Uli Kusterer | Nov 6, 23:40 | |
| Paul Bruneau | Nov 7, 17:14 |






Cocoa mail archive

