<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
On 5/27/2010 3:51 AM, Morad IGMIR wrote:
<blockquote cite="mid:035e01cafd71$783ce930$68b6bb90$@com" type="cite">
  <pre wrap="">Hello Steve,

I think your business logic should be moved to the model, not the
controller.
The model does the heavy lifting.
  </pre>
</blockquote>
My model is currently comprised only of my DBIC Result and ResultSet
classes.&nbsp; Are you suggesting that some of the logic in my controllers
should be moved into my DBIC classes, or should I create new Moose
classes.&nbsp; If Moose, how do I 'hook up' those classes to Catalyst?<br>
<blockquote cite="mid:035e01cafd71$783ce930$68b6bb90$@com" type="cite">
  <pre wrap="">
Your controllers would be easier to maintain if they only did simple tasks
like
dispatching, calling models and forwarding to views,  as said on the
catalyst wiki : 

"Decouple as much as possible. If you have to fire up your web application
in order to test database insertion, that's wrong. Build the model so that
you can use Perl one liners to manipulate data through it."

<a class="moz-txt-link-freetext" href="http://wiki.catalystframework.org/wiki/best_practices#Follow_the_Catalyst_di">http://wiki.catalystframework.org/wiki/best_practices#Follow_the_Catalyst_di</a>
et:_thin_controller.2C_fat_model.

I know it's easier said than done when you've spent time building huge
controllers,
but it really pays off.
  </pre>
</blockquote>
Your comments are appreciated, as I'd like to learn some lessons before
moving on to my next application, which is going to be much more
involved.<br>
<br>
Thanks!<br>
<blockquote cite="mid:035e01cafd71$783ce930$68b6bb90$@com" type="cite">
  <pre wrap="">
Regards,

Morad IGMIR

-----Message d'origine-----
De&nbsp;: Steve [<a class="moz-txt-link-freetext" href="mailto:steve@matsch.com">mailto:steve@matsch.com</a>] 
Envoy&eacute;&nbsp;: mercredi 26 mai 2010 22:39
&Agrave;&nbsp;: The elegant MVC web framework
Objet&nbsp;: [Catalyst] Refactoring question

Hi all,

I'm searching for general advice on Catalyst app design.  I've been studying
all the banter on this list for almost a year, and have finally gotten to
the point where a real live application is underway.  Being a newcomer to
web dev in general, and also that this application wasn't originally
supposed to go into production, I didn't give app design much of a thought
(controllers in particular).

The app I'm writing generates HTML invoices/statements for individual
subscribers.  The database consists only of 4 tables: users, roles,
user_roles, and invoice_data.  Don't laugh too hard, but I called my first
controller 'WebUsers', and a second one 'ViewStmt'.  The authentication is
remarkably similar to the examples I've seen :)  As you might imagine, the
WebUsers controller is starting to bloat as it has to maintain users, log
them in/out, and basically handle all the 'heavy-lifting' for the
application.  The ViewStmt controller basically handles the rendering of a
statement, and is quite manageable.

There are only two roles: administrator, and individual.  Individuals can
log in/out, and view their own statements - period.  Administrators on the
other hand need to administer the users, so basic CRUD for that part.  They
also can view statements for anyone, so I've got a nifty list that gets
presented, and links to individual statements.  All of the logic for
handling this functionality is in the WebUsers controller.

I'm wondering if I should refactor all of the user maintenance stuff out of
WebUsers, and into its own controller, or just deal with it as * this
application won't ever be expanded on * .

Thoughts, advice, wise-cracks are all welcome :-[

Ce message entrant est certifi&eacute; sans virus connu.
Analyse effectu&eacute;e par AVG - <a class="moz-txt-link-abbreviated" href="http://www.avg.fr">www.avg.fr</a>
Version: 9.0.819 / Base de donn&eacute;es virale: 271.1.1/2880 - Date: 05/26/10
08:25:00


_______________________________________________
List: <a class="moz-txt-link-abbreviated" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext" href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext" href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>
  </pre>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>

No virus found in this incoming message.
Checked by AVG - <a class="moz-txt-link-abbreviated" href="http://www.avg.com">www.avg.com</a> 
Version: 9.0.819 / Virus Database: 271.1.1/2898 - Release Date: 05/26/10 14:26:00

  </pre>
</blockquote>
</body>
</html>