Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Understanding Catalyst

by locked_user sundialsvc4 (Abbot)
on Oct 03, 2015 at 12:45 UTC ( [id://1143712]=note: print w/replies, xml ) Need Help??


in reply to Understanding Catalyst

Methinks that you have “Model” and “View” confused in your mind . . .

(See Catalyst::Manual::Intro.)   The MVC view-of-the-world basically goes like this:

  • Model:   Access to data, manipulating data, allowing the rest of the application to functionally-ignore where the data comes from and how it is stored.
  • View:   The presentation layer.   Templating and output-preparation goes here.   (Not in the Model.)
  • Controller:   Everything else.

And, while the MVC paradigm is a useful way to look at some things, it really only works really-well with CRUD (Create, Read, Update, Delete) applications, where the user’s conceptual model of what he is doing is fairly close to “I am manipulating records in a database, and I can do anything I want with anything that I see.”   When the application becomes more complex than that, the MVC model starts to be a bit simple-minded and application logic starts showing-up in places other than where MVC says it “ought” to be.   (Even given that the role, scope and bounds of “Controller” is already quite vague.)   Therefore, understand how the MVC abstraction is put together, but consider it to be an abstraction of what any given application may in fact require.

Catalyst is a good framework.   Dancer is another.

Replies are listed 'Best First'.
Re^2: Understanding Catalyst
by QuillMeantTen (Friar) on Oct 03, 2015 at 16:22 UTC

    In this application I did not use a database, I used cookies and the $c->session hash to manage everything, would it be more appropriate to put all the manipulations inside the Model instead of the controller?

      I’m not sure that the MVC paradigm really addresses that concept very well.   If the application has no persistent storage, I’m not sure if one would say that it has a Model.

      However ... “there are no absolutes.”   MVC, like everything else, is a guideline not a mantra.   If you have developed something that works cleanly for you, I would not redesign it for the sake of philosophy.   :-)   Others may weigh-in with differing opinions.

        Model != Storage. Model == Data. Google search API is a model, for example. A weather service is a model. sub d10 { 1+int(rand(10)) } is a model.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1143712]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2026-01-23 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (125 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.