hi there Simon,
Good morning. I am interested in hearing more about this.
IMO the best place for your business logic is the controller.
A view is made out of the html (usually templated with a templating
system such as template toolkit).
For example, in an application that sells insurance (doing away with any
javascript which does any business logic):
1) customer will pick out a premium and associated options on a webform
2) the submit button on the webform gets clicked
3) a method in the controller gets called and before data gets saved,
two things typically happen:
- validation of input
- working out of some values. For example, with the chosen premium
and associated options, a method within the controller will need to be
called to work out the exact pricing),
4) confirmation screen gets generated and with the click of the submit
button on the screen, the
saving of data to the database tables will take place.
Perhaps I am subscribing to another school of thought but I would like
to hear your thoughts in this.
Thank you.
K. akimoto
Quoting Simon Wilcox <[email protected]>:
> On 22/4/09 14:52, Matt S Trout wrote:
> > On Wed, Apr 22, 2009 at 02:41:34PM +1000, [email protected]
> wrote:
> >
> >> I just looked at my app and found that I need to reuse the
> Schema
> >> files found in my 'Schema' directory.
> >
> > Your DBIC classes aren't connected to the Catalyst app at all.
>
> Unless you've fallen into the trap of putting business logic in your
>
> Controller classes.
>
> See this as a good opportunity to refactor the logic back into the
> Schema classes where it belongs (or to a set of business objects if
> that
> suits your application better).
>
> Your code will be better for it :-)
>
> S.
>
>
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/