MVC is an all around more rigidly structured way of handling the web, it tends to yield better code on the whole, while being easier to divvy out amonst a team. It is more so maintainable and scalable.
You have three fine divides, a model - interacts with the database (makes the data accessible in your language of choice), a controller which can access a model and holds all of your programming logic, and a view which simply reads from the context variable - catalyst's stash, rail's flash/other misc custom globals, etc.
- More than one medium can access the model, the interface to the db in perl, Class::DBI, DBIx::Class custom DBI modules etc, in our implementation, the models are recycled and I use the same modules when inserting data with web crawlers, that i do when users add the data themselves.
- The controller is often kind of like a server side http/rpc, and can be largely reused, http://foobar.com/1/2 will in most implementations dispatch to the function '1', the arg '2', in Catalyst you can form this 10900498084 different ways, you could in the path '1/2/3/4', send the function 1, the value 2, the function 3 the value 4, etc, these functions are written in the controller logic
- view is any of the many template languages available to what ever lang you pick. TT, embperl, etc these only deal with presentation logic.
The best Mason users, found on the mailing lists, will highlight these points in their methodologies, which largely mimic MVC now too. they often put their model functions in modules, isolated from the .mas files. A dhandler in mason is easily abstracted to be a controller, and the autohandler and seamless calling chain are the powerhouse of the language. If you start doing this too, and then you pick up a true MVC framework, you might come to view Mason as less developed -- I have.
Evan Carroll www.EvanCarroll.com
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|