[Catalyst] To plugin or not to plugin; style/best-practices

David K Storrs dstorrs at dstorrs.com
Wed Dec 14 20:12:31 CET 2005


On Dec 14, 2005, at 2:02 PM, Brandon Black wrote:

> On 12/14/05, David K Storrs <dstorrs at dstorrs.com> wrote:
>>
>> On Dec 13, 2005, at 7:40 PM, apv wrote:
>>> [...] it's information that is going into the
>>> DB as opposed to--directly, anyway--the screen.
>>
>> In that case, shouldn't it be in the model?  Have the Controller send
>> raw text with \n\n and let the Model class sort out what to write to
>> the DB.
>>
>
> [...]Perhps a more correct way to do it (but not arguably the most
> practical) would be to have the formatter module/plugin mentioned
> above merely validate and parse the comment into some internal
> representation that is neutral wrt specific display formats like HTML,
> PDF, etc, and then store it into the Model in that neutral format
> (say, a special xml dtd you invent for user comments).  Then various
> Views can in turn process the neutral format into whatever they need
> to see it as.  But you won't see any practical benefit to going
> through all that trouble until or if you ever have another type of
> View on user comments.
>
> -- Brandon

Or until you get another controller that wants to accept user  
comments, but it has a different field name, or a slightly different  
format, or whatever....

This actually sounds better to me than my suggestion of "let the  
Model do it".

--Dks



More information about the Catalyst mailing list