[Catalyst] Re: Catalyst Digest, Vol 12, Issue 61

Karl.Moens at marsh.com Karl.Moens at marsh.com
Thu Feb 16 14:45:05 CET 2006







Ian Docherty <icd at ecisecurity.com> wrote:

> So, if the view was changed to use some other method that (for example)
> used a radio button, or a drop-down, instead of a checkbox then only the
> view would change (to process the input) and the controller would remain
> unchanged.
>
> I argue then that 4 *does* belong in the View and not the controller.

The interaction between the Controller and the View is based upon the
concept of "implied contracts" (sorry to speak legalese here, but I am a
lawyer after all). The Controller has agreed to send the View a certain
amount of data in a pre-arranged format and the View has agreed to return
some data to the Controller in (another)  pre-arranged format. The View may
decide to change the way it looks, but it cannot (without bad consequences)
change the format of the data returned. So either the View internally
transforms the data from the new format to the old format (which will
probably need some Javascript, because TT is already out of the loop when
the data returns) or it negotiates a new contract with the Controller. This
has nothing to do with the various components of the M V C concept being
agnostic of each other, but everything with a clear division of tasks AND
keeping to the implied contracts which exist between the various
components.

The same goes between the Model and the Controller: the Controller couldn't
care less about the back-end storage used by the Model, but it does care
about the data it will receive from the Model. There is a heavy price to
pay if all of a sudden the Model changes the field names or the encoding of
the data or the date-format or ...

Karl
aka CountZero on Perlmonks



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This message and any attachments are confidential. If you have received
this message in error please delete it from your system. If you require any
assistance please notify the sender. Thank You.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the Catalyst mailing list