Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: MVC question: way to expose API

by Anonymous Monk
on May 12, 2008 at 03:13 UTC ( [id://686025]=note: print w/replies, xml ) Need Help??


in reply to Re: MVC question: way to expose API
in thread MVC question: way to expose API

Definitely agreed on keeping view-related things in the view, but IMHO you really want to (as much as possible without breaking the layer abstractions) put as much as you possibly can into the Model layer.

Think of it this way: the Model layer *is* your application, in an abstract sense. It is your application without any regard for specific output formats or input methods. So if part of your application involves generating summary reports of database data, there probably should be a model class/method which handles report generation.

However, it should only generate the report data based on abstract input parameters, and not deal with any user parameter input or user output formatting. An appropriate controller would gather user report parameter input from an HTML form or an emailed form (or a voice-prompt UI over a telephone), and an appropriate View would transform the report data into HTML or PDF (or text to speech) or whatever output flavor of the month.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-24 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found