[Catalyst] Program the logic
Matthieu Codron
matthieu at codron.org
Fri Jun 30 01:07:06 CEST 2006
Brandon Black a écrit :
> [...]
> Controller(s) - This is the glue that binds Models and Views together.
> It accepts user input, possibly makes modifications to Model data,
> possibly retreives some Model data, and then displays a View at the
> user who gave the input. This is where the business logic goes. This
> is where anything that officially doesn't belong in Views and Models
> goes, basically.
>
> That's the ideal situation in my mind. Obviously in the real world
> you sometimes deviate from this, for reasons like "I don't have time
> to design the proper abstraction before this looming deadline", or
> "doing it the right way is just provably too inefficient in this
> particular case". But its important to keep the ideal in mind and
> strive for it.
Except that if business logic is in the controller then you are mixing
it with web-related stuff (parameter retrieval, sanity checks, ... ).
This does not matter much in most cases except big projects where
business logic elements are reused in various situations around the
application.
In J2EE projects, the layer model is more like "MSCV-I", for Model -->
Service --> Controller --> View, the "I" standing for Integration layer
(Spring for example, or Catalyst in Perl)
What is missing in Catalyst is that "Service" layer. But it's not a big
deal in most cases, IMHO.
--
Matthieu
More information about the Catalyst
mailing list