It depends on what you mean by "appropriate methods", but if you're talking
about something similar to what Peter used an an example:

If (Order.isValid())
{
   Order.save();
}
Else
{
  Screen = OrderForm;
  Data = Order;
};


No, I wouldn't be doing that in the Controller (and I think we might be
getting some miscommunication here because I'm pretty sure Peter and Sean
wouldn't either). My Controllers are very dumb. The only thing they do is
ask the Model to perform some business logic (via the service layer), and
then invoke the appropriate views or execute a redirect. That covers 99% of
what my Controllers do.

The problem with doing something like the above in the Controller means that
the model is no longer neutral and self-contained. I can't call the service
layer from Flex now, because the logic that checks validity and does saving
is executed by the Controller, not the Model. I would have a method in my
service named something like "orderService.saveOrder(orderData)", and
internally that service layer method might create an Order, validate it,
save it, and return a success or failure result that the Controller can then
use to determine how to proceed (cflocation or redisplay form with errors,
for example). I'm pretty sure that this is what Sean and Peter are also
talking about.

On Jan 14, 2008 9:11 PM, Baz <[EMAIL PROTECTED]> wrote:

> Sean, Brian, it seems you are both on board with getting a newUserBean()
> from the service in the controller then calling the appropriate methods on
> that UserBean later on in the controller. Do you also handle queries or
> multiple objects in the same way that Peter does? That is, do you code
> gateway-type methods into your service that interact with a DAO/Gateway to
> return multiple instances of your object?
>
> Baz
>
>
>
> On Jan 14, 2008 4:40 PM, Brian Kotek <[EMAIL PROTECTED]> wrote:
>
> > Absolutely, I didn't mean to imply that the service actually does
> > everything itself.
> >
> >
> > On Jan 14, 2008 7:35 PM, Sean Corfield < [EMAIL PROTECTED] > wrote:
> >
> > >
> > > On Jan 14, 2008 1:19 PM, Brian Kotek < [EMAIL PROTECTED]> wrote:
> > > > I think he is saying that his controllers only interact with
> > > services. The
> > > > easy rule of thumb for me is: if this was called by Flex instead of
> > > my HTML
> > > > controller, would it still work? The answer should be "yes". Which
> > > means all
> > > > logic of any consequence (beyond doing something like a cflocation,
> > > which is
> > > > specific to the HTML view anyway) should be handled in the model.
> > >
> > > Right, but that can still be in the domain object rather than the
> > > service. You just need to expose the API via the service for remote
> > > interaction. It doesn't mean all the business logic is in the
> > > *service* which is at the heart of Baz's question, I believe.
> > > --
> > > Sean A Corfield -- (904) 302-SEAN
> > > An Architect's View -- http://corfield.org/
> > >
> > > "If you're not annoying somebody, you're not really alive."
> > > -- Margaret Atwood
> > >
> > >
> > >
> >
> >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to