[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Mason] www.masonhq.com back to work? Pedro Melo Mon Feb 13 08:00:52 2012


On Mon, Feb 13, 2012 at 1:55 PM, Jonathan Swartz <[EMAIL PROTECTED]> wrote:
>> Am 11.02.2012 um 13:04 schrieb Jonathan Swartz:
>>>> Nowadays, the action has moved on to other places, like the Catalyst list.
>>>> People still use Mason 1 and/or 2, but it's a much smaller part of their
>>>> development stack. This, BTW, describes me. I use Mason 1 solely for
>>>> templating on new projects. If I switch to Mason 2 that won't change.
>>> Yes, sadly Dave is one of those that believe in a separate controller layer 
>>> in modules. They are all wrong, but they comprise about 90% of the Perl 
>>> community so what can you do :p
>> Could you explain your opinion about this "They are all wrong" a bit more ?
> Nic Wolff summarized this pretty well, but I'll give my spin.
> In Catalyst, URLs are handled by controller classes. A controller gathers 
> data from appropriate model(s), then constructs a hash of data and passes it 
> to a template to render the page.
> In theory the controller method and template are decoupled, so that you could 
> create multiple templates for a single controller method (one for browser, 
> one for mobile, etc.).
> In practice, there is almost always a one-to-one correspondence between 
> controller method and template, and the two *are* quite coupled. If you want 
> to figure out how a page is rendered, you have to look at both the controller 
> and view. If you want to change how the page is rendered in any meaningful 
> way, you have to modify both the controller and the view. So I find that with 
> Catalyst development I'm constantly having to look in, and edit, two places 
> at once. I also have more decisions to make about which code goes where.


> In Mason, URLs are handled by components. A component gathers data from 
> appropriate model(s), then renders the page itself. You only have to look in 
> one place and modify things in one place.

+1. This is what I love about Mason. My "controller" and "view" are a
single unit.

In Mason 1 we got a bit of too little separation and it could get
messy really fast if you didn't make sure your logic was stashed away
properly in business classes (aka, your "Model") but I do like
View-driven web frameworks that call into the model to pull the
required information.

When I do Catalyst, my controllers are a glorified routing setup
system to views. I like chained actions to perform preloading (over
async protocols if available) of data I know I will need (some might
call this premature optimization), or for
authentication/authorization, but the rest is all View-driven.

I'm not a fan of the component-as-a-object of Mason2, but maybe its
because it hasn't *clicked* yet. I do like the fact that it is

Pedro Melo

Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
Mason-users mailing list