[Catalyst] template comparison (was: why not mason (was: somethingelse unrelated))

Joe Landman landman at scalableinformatics.com
Fri Oct 27 23:25:34 BST 2006


I've ignored this for the most part until here ...

Alan Humphrey wrote:
> 
> -----Original Message-----
> From: Jonathan Rockway [mailto:jon at jrock.us] 
> Sent: Friday, October 27, 2006 11:03 AM
> To: The elegant MVC web framework
> Subject: [Catalyst] template comparison (was: why not mason (was:
> somethingelse unrelated))
> 
> Max Afonov wrote:
>> Why don't I _ever_ hear about Mason on this list? How is TT better than
>> Mason anyway?
>>
>> ...not meaning to start a flame war...
> 
> Mostly because mason becomes an unreadable mess, just like PHP.  Take a

???  This comment makes sense for PHP, not Mason.

> look at the RT source code, or my clever example here:
> 
> Mason:
> 
> <table><% my $sth = $dbh->prepare('SELECT columns FROM table WHERE
> something=1'); for($row = $sth->fetchrow_arrayref){ %></table>

Ahh...  Apples

> 
> 
> TT (in Cat with DBIC):
> 
> <table>
> [% WHILE (row = rows.next) %]
> <tr>
>   <td>[% row.name | html %]</td><td>[% row.whatever | html %]</td>
> </tr>
> [% END %]
> </table>

and oranges... I get it.

If this is they way you write your views in Mason, you have larger
problems to deal with.

> 
> [Alan Humphrey] -------
> c'mon now.  Be fair in your comparisons.  Wouldn't the Mason/Cat/DBIC
> example look something like:
> 
> <table>
> % while (my $row = $rows->next()) {
> <tr>
>     <td><% $row->name %></td><td><% $row->whatever %></td>
> </tr>
> % }
> </table> 

yes, this is more apples to apples, and it looks and feels quite a bit
more Perl-ish to me than TT.

> I agree that Mason templates can become a mess, but they don't have to.  And
> there's something to be said for working in a language you know (Perl) in
> lieu of learning another (TT).

Yes.  You can make a mess out of any language, maxi or mini.

I use Catalyst::View::Mason after migrating from pure Mason for our apps
in large part due to a) the ease of developing applications in Perl (and
hence Mason), b) that I am already familar with Mason.

No one wants/needs a flame war over templating, and frankly it is quite
silly.  Sort of a "which langauge is better" argument.  Doesn't mean
much and pisses off people who should be doing more productive things.

FWIW: our commercial app frontends are developed in Mason.  Our next
generation app frontends will be in Catalyst + Mason views.  I see no
reason to change this, it gives us maximal flexibility, and we can write
in exactly one language.

Had we been a TT shop before, we probably would have done TT.  Had we
been neither, and just researching it, my preference would have been
towards Mason due to what I perceive as its strengths.

The point of this being a) Catalyst is sufficiently powerful that you
can use whatever you are most comfortable with as a view.  Mason, TT,
HTML::Template, Embperl, ClearSilver, PHP, Petal, ... b) as a result of
its power and flexibility, you have clear choices.  You can even mix and
match ....  if this is really a good idea is left to others .


Joe

-- 
Joe Landman
landman |at| scalableinformatics |dot| com



More information about the Catalyst mailing list