Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Catalyst or Dancer?

by Anonymous Monk
on Apr 22, 2011 at 17:17 UTC ( [id://900844]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Starting a new web project, and both Catalyst and Dancer look like great places to start. What reasons are there for going with one over the other? What kinds of sites would each be most appropriate for?

Replies are listed 'Best First'.
Re: Catalyst or Dancer?
by saberworks (Curate) on Apr 22, 2011 at 19:47 UTC
    I haven't used catalyst other than following a tutorial or two but I have used Dancer and can provide some impressions of that.

    First, it's route definition code is really nice. It's really really easy to define routes and it's really easy to run a local development server and start making progress right away. It doesn't provide the same level of functionality as catalyst (it's much smaller and has less plugins). For me that's a good thing.

    There are some things about it I don't like. First of all, the way it provides all functionality through "keywords" like "template" (and plugins do the same thing, DBIC is "schema"). In all their documentation they have these keywords that look like barewords (no sigil) but are treated as objects, references, etc. What they really are is functions that have prototypes (so you don't need to use parentheses) that return references (to objects, hashes, etc.). I've been programming perl for a really long time and it's difficult to get used to that style. In fact I generally pull them out as vars at the beginning of my functions so I can use them in a more regular way. Like my $schema = schema(); Here's a more specific example, here's how you access request parameters:

    return "Hello " . params->{name};

    I would much prefer a $params object where I can say $params->name() or a $params hashref where I can say $params->{name}. So I end up saying my $params = params(); and getting said hashref so I don't have to look at unhighlighted "barewords" everywhere.

    The setup in Dancer is tied to YAML which I'm not a fan of but I don't have to touch it often so it doesn't bother me too much.

    The logging interface is pretty limited. There are plugins that you can use to get different logging but it's still a pain. The problem is that application-level stuff goes to one log (say development.log) but messages about syntax errors and other crashes goes to the logging mechanism of whatever thing you're running the server as (plack, apache, etc.). This means I have to tail more than one log during development to see what is going on.

    The mailing list is generally helpful although every dozen or so questions that go through seem to go unanswered.

    The development process there is cumbersome and it's difficult to get even simple changes approved (and merged in). They are using github in this complicated way where they develop against "devel" branch but then when they are on the verge of release everyone has to stop using "devel" and use something else for some period of time. It would make more sense to just branch devel into a release branch so development can continue on "devel."

    There is no way to set session timeouts dynamically (you have one setting in the conf file and that's it). Makes it difficult to have a "remember me" checkbox on login pages.

    I think were it up to me I'd take the route handling stuff alone and plug in my own modules (and by "my own" I mean picking the ones I like from CPAN) for logging, development server, templates, sessions, db, etc.

    It is actually now possible to only import some "keywords" (those prototyped functions that return references) and not others. This has made it easier to use some of the Dancer-provided functions in other modules. This wasn't possible when I started my project so I had already worked around that by using my own logging modules and whatnot.

      Thanks for all the detailed info, saberworks!

Re: Catalyst or Dancer?
by moritz (Cardinal) on Apr 22, 2011 at 18:15 UTC

      My project will require user login, user pages (with some user-supplied categorized content), comments on pages, and functionality for browsing the categorized content.

      That said, I tried to phrase my question to also be useful in general for any monks that come after me looking for pros and cons of using Catalyst vs. Dancer.

      Since you mention Mojolicious, do you know of any compare and contrast page discussing Catalyst, Dancer, and Mojolicious?

        My project will require user login, user pages (with some user-supplied categorized content), comments on pages, and functionality for browsing the categorized content.

        All three frameworks make it easy to provide that functionality. So it's really up to your personal preference.

        Mojolicious is an all-in-one solution with minimal dependencies; it comes with a full asynchronous IO loop, web server, user agent and HTML parser with DOM interface.

        Dancer has a similar routing syntax (at least on the surface, haven't used it in depth), reinvents fewer wheels but also comes with less built-in functionality.

        Catalyst is the oldest and most mature of the three, with many existing plugins. Books have been published about it, so there are plenty of resources for learning.

        Have fun rolling your die.

Re: Catalyst or Dancer?
by John M. Dlugosz (Monsignor) on Apr 23, 2011 at 00:47 UTC
    I've been doing a bit of Catalyst of late, and I just read the Dancer introduction. It appears that Catalyst is much more flexible with more options for everything, and has many more plug-ins already available. I didn't see anything about the "Model" part of MVC in the Intro.

    Examples for "different options": For templates, Dancer has its own mini-system (to prevent a dependancy I suppose) and can optionally use TT. I'm using Alloy, as an upgrade from TT. Dancer uses YAML for everything; Catalyst can use anything. Why not use config any? I guess they want to keep the dependencies down.

    Forms: not covered in the Intro for Dancer, but I expect the same story: use what they included. With Catalyst you can use anything, and high integration is available for several popular systems (I'm using FormFu).

    Dancer's GET syntax gives a whole string with wildcards. It's up to you to organize them into different files. I'm guessing that's actually a prototype argument of $, so you could interpolate into the string and abstract the path structure somewhat. Catalyst abstracts out the path by default and you give just the right-most part of this overall part of the tree you are working in.

    I don't plan on changing. My stuff is only going to get more complicated, and I have no trouble using it for simple pages since I'm already over the learning curve.

Re: Catalyst or Dancer?
by CountZero (Bishop) on Apr 22, 2011 at 18:59 UTC
    Unless you have very specific requirements, I'd just flip a coin and choose one at random.

    But perhaps, first try to install them on your box. I'd then go for the one that installed the easiest.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Catalyst or Dancer?
by mikeraz (Friar) on Apr 22, 2011 at 18:54 UTC

    Starting a new web project? Have you done this before? What kinds of sites have you created? What kind of site do you want to build?

    Answering these questions and a half day with each of your candidates will answer your question.


    Be Appropriate && Follow Your Curiosity
      Starting a new web project?

      Yes.

      Have you done this before? What kinds of sites have you created?

      I've worked on larger php sites (but not created them myself). I've created small toy sites with CGI::App, Python's Django, and gone through a Rails tutorial long ago. Some experience with Apache, MySQL, and basic GNU/Linux admin tasks.

      What kind of site do you want to build?

      See one of my replies elsewhere in this thread: Re^2: Catalyst or Dancer?

      and a half day with each of your candidates will answer your question

      Ok, but it would also be helpful to see what others think of as the strong points of each of the different frameworks.

Re: Catalyst or Dancer?
by jdporter (Paladin) on Apr 22, 2011 at 23:53 UTC

    Good question with some good discussion. But I'm disappointed that, while the various packages were referenced by name numerous times throughout the thread, not once did anyone feel obliged to link to the distros.

      > not once did anyone feel obliged to link to the distros.

      And thou, Brutus?

      Cheers Rolf ;-)

        And thou, Brutus?

        Holy Shakespere LanX-man! Et tu, Brute?

        I didn't mention any mods/dists by name, did I?

Re: Catalyst or Dancer?
by Anonymous Monk on Apr 22, 2011 at 18:11 UTC
    I'm going to make a sandwitch later on and I was hoping the PerlMonks could help me out...Peanut Butter or Jelly?

      I'd vote for peanut butter and jelly. Could even sing a song about it if it would help your decision, cuz that's just the type of people we are. ;)

        hazelnut butter and pear jam

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found