in reply to Re^9: Understanding Catalyst
in thread Understanding Catalyst

Okay. I thought you were being a bit… contrary. But it's a real question and a real concern. To address it might take volumes though. …trying to boil down… …working… …loading…

Non-colliding namespaces are cheap, nearly free, in Perl. The main point of MVC is organizing concerns, organizing thought. Interpreter don’t care. Dev does. The controller should do nearly nothing. Really. Including hardcoding itself. uri_with, uri_for, and uri_for_action make the controllers themselves terribly flexible. Fat models (where the business logic is part of the data control) are the most reusable and therefore the obvious choice. Views should do all the branching of what is sane to show. The Controllers therefore do only the most obvious filtering, dispatching. A controller sub longer than… 40 lines is probably in need of abstraction or not relying enough on the M and the V.

Let’s pick a more reasonable idea than Games::Dice. Let’s try LWP::UserAgent. Now your Controller classes are *littered* with has "ua" =>,  my $ua = …, and such. Completely uncool but obvious, understandable, readable. Then you decide you wanted to do a bit more and want to update to WWW::Mechanize. You have 20 Controllers and hundreds of lines of code to change, validate, test, and pray; maybe more if you were using default headers or something. Or you adjust the base class of your Model. The point of something as grand as Catalyst is growth. If you don’t care, or won’t grow, then bare Plack/PSGI is there or Mojolicious::Lite, etc. Gratuitous “best practices” are only gratuitous if the code is throw-away.

Replies are listed 'Best First'.
Re^11: Understanding Catalyst
by Anonymous Monk on Oct 05, 2015 at 23:39 UTC

    ...relying enough on the M and the V. Let’s pick a more reasonable idea....

    Thank you. Do you have some links that are more in-depth ... that explain more of the why not just do-x like this?

      I don’t… well, I do but… oh, it’s a long story! You’re not my real mom, Stephanie!!! I recommend ISBN 9781430223658 and I will go so far as to say this excellent guide contains some of my code. They didn’t cite me though so my secret identity is safe. …and I’m totally not mad about not being cited… anymore… mostly. Anyway, I’m safe unless tye starts comparing visits and cookies against stuff and things.