On Jan 15, 2008 5:20 PM, Baz <[EMAIL PROTECTED]> wrote:

> So lets move the conversation onto that question.
>
> Does anyone have any examples of some functionality that gets invoked
> during OrderService.saveOrder() that they feel should necessarily not be
> composed into the OrderBean object? For example, lets say a form submission
> sends over both data for a new order and data for a new user registration.
> In the form handling event you will have to both create a new user and
> create a new order.
>
> Would you:
>
> #1 Interact with 2 separate objects USER and ORDER in your service to
> perform the save:
> <!--- service function --->
> <cffunction name="saveOrder">
>
>    - validate USER
>    - validate ORDER
>    - combine validations
>    - check if *everything* is valid
>    - save USER
>    - save ORDER
>    - return complex RESULT object with messages and both USER&ORDER
>    objects
>
> </cffunction>
>

I would probably take this approach. One reason is, if something in the
order were to fail, but the user registration was successful, it would seem
rather inconsiderate to fail the entire thing and make them register again
too.


>
> Which is better?
>
>
As always, it depends on your application. However, I wouldn't think that it
makes much sense in most applications to try and wrap the User inside the
Order. That would seem to begin a slippery slope towards a whole bunch of
"User-oriented" methods in your Order. In some cases it might make sense to
do this, but overall this doesn't sound like a good approach.


> And what about cases of LOGGING or STATS (rather than USER) that really
> aren't an ORDER's concern but may need to be affected as well during the
> save() function?
>

AOP

--~--~---------~--~----~------------~-------~--~----~
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