-- Matthew Ratzloff <[EMAIL PROTECTED]> wrote (on Monday, 03 November 2008, 09:49 AM -0800): > I genuinely can't fathom how a controller could be 3000 lines long without a > serious organization problem. Give us some examples of what your URLs look > like.
I'm going to have to agree here. The rule of thumb I use -- based back on my CGI::Application days -- is that an action/page controller should only have around 7 actions, maximum; more than that, and it should be broken apart into more discrete controllers. The rationale is that the more actions you add, the less likely that they are all related, and you can likely create sub-groups of actions. Additionally, as someone else noted, if you have 3000 lines, chances are that you're probably doing a lot of business logic in your controller - and you should move that logic into model classes. Even there, make sure you refactor so that you have discrete methods doing discrete actions. If you have more than a screen full of code in a method, it's harder to read and maintain (not to say you should *never* do this, just that it's a good rule-of-thumb to follow). > On Mon, Nov 3, 2008 at 6:22 AM, Christopher Östlund < > [EMAIL PROTECTED]> wrote: > > Don't put businesses logic into the controllers. Controllers should > contain > application logic. You business logic should be in your models. > > > On Mon, Nov 3, 2008 at 3:17 PM, monk.e.boy <[EMAIL PROTECTED]> > wrote: > > > Hi, > > Seeing as we're talking speed, I have a question. One of my > controllers is > close to 3,000 lines long, that section of my site has many, many > pages. > > Before I ZF'd my site, I just had a lot of .php files. How come I > need > to > merge all these into one controller? Why does the parser need to parse > hundreds of actions that are never going to be used? > > I would like a "super-controller" to pick the the correct controller > for a > page, like the view picks the correct .phtml file. The > super-controller > would look at: http://site.com/section/view-stuff/ and load controller > 'section' which would load /application/controllers/actions/ > view-stuff.php > > Am I missing the point? > > monk.e.boy > -- > View this message in context: http://www.nabble.com/ > Controller-Speed-tp20303550p20303550.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > > > > -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
