[Catalyst] App design questions
David Storrs
dstorrs at dstorrs.com
Wed Aug 17 16:28:48 CEST 2005
On Aug 17, 2005, at 9:42 AM, Marcello wrote:
> Simon Miner ha scritto:
>
>> Hi,
>> When writing a web site using Catalyst, is it better to use one
>> big application with many controllers, or several smaller
>> applications with fewer controllers in which each app is broken
>> down by function (i.e. order, search, etc.)? In the scenario I am
>> considering, the site functions are somewhat distinct, but the
>> underlying models are shared between them. What are the pros and
>> cons of each approach?
>>
>
> Well, since the "models" are shared, I would say the natural
> approach is one model (i.e. one database and an ORM package) and
> several controllers, each of which deals with a particular set of
> related functions.
I think he's saying that the framework models (the Cat::M::<name>
modules) are shared, whereas you are saying that the pattern Model
(the 'M' in MVC) is shared.
Correct me if I'm wrong, either of you.
> I don't really understand why one would implement a website using
> multiple applications...
I tend to agree with this point. I would have one application and
divide the functionality between different Controllers.
Unless you see some specific gain that you will be able to make my
having multiple applications? If so, what is it?
>> Also, I am noticing that in the Catalyst examples, the view MVC
>> layer sometimes contains logic that some might think better suited
>> for the controller. For example, the HOPS and Scaffolding apps
>> have calls to the Class::DBI retrieve_all methods With regard to
>> MVC, should this database call be in the controller? If I wanted
>> to change the UI, it seems like this process would be made more
>> complex by the presence of such code in the view layer. Are their
>> processing considerations for setting things up the way that they
>> are? (I’m no MVC purist, mind you…just curious.)
As always, it's a matter of purity versus real world constraints,
with a dash of personal preference thrown in.
My approach is to have the Controller do all the work of generating
the relevant information and sticking it into the stash. All the
view does is display information that is in the stash. This still
ties me to a particular set of names and values in the stash, which
in turn puts some constraints on the logic that generates those names/
values. I don't see any way around that.
--Dks
More information about the Catalyst
mailing list