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>

OR would you abstract the USER away into you ORDER object:

<!--- service function --->
<cffunction name="saveOrder">

   - validate ORDER (which internally also validates USER and combines
   the errors into one collection)
   - check if ORDER is valid (which also checks USER since validation is
   combined)
   - save ORDER (which internally saves USER too)
   - return ORDER (which can be checked for validation errors and all
   transient data including that of USER)

</cffunction>

Which is better? 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?

Baz


On Jan 15, 2008 2:02 PM, Peter Bell <[EMAIL PROTECTED]> wrote:

>  Aha, makes perfect sense.
>
> Best Wishes,
> Peter
>
>
>
> On 1/15/08 4:39 PM, "Brian Kotek" <[EMAIL PROTECTED]> wrote:
>
>
> This is exactly what my Result object wraps up. Things like the original
> data (or an object containing that data), whether it was successful, and any
> messages, etc.
>
>
>
> >
>

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