I've been making my listeners pretty dumb and putting all the business logic
into the objectService.cfc.  Seemed like a good idea at the time, but now
that I think about it, it does seem like I'm creating a pretty pointless
layer of abstraction.

Going back to the validation though...

As I mentioned, I've been using the objectBean.cfc / validateFormObject.cfc
approach as suggested in the machii development guide.  Could I then create
a objectBeans.cfc that is an array of objectBean instances with its own
validate method?  
The validateFormObject.cfc would then call the objectBeans.cfc validate
method which would process the validate method for each instance of the
objectBean.  Then the errors would trickle up somehow... Or have I gone off
the deep end?

Thanks for the help and also thanks for making the mach-ii.info code freely
available.  It's still an invaluable learning resource for me.

Sam

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Phil Cruz
Sent: Tuesday, January 18, 2005 12:13 PM
To: [email protected]
Subject: Re: [CFCDev] Multiple object instances from a single form

If you are implementing the service layer because that is how you think you
need to achieve this functionality I would say that is somewhat off base.

Patterns have certain "driving forces" that justify their implementation.
For example, if you wanted to support multiple database platforms that would
"drive" you to implement an Abstract Factory pattern.  If you want to
provide a "API" of your application such that it can support multiple client
types (HTML/Flash/Mobile
phone/...) then you may want to implement the service layer.

You may have other reasons to implement a service layer but doing so to
create multiple object instances and persist them doesn't sound like a valid
one.

As for validation code, you would typically have some validation code in the
BO.  If you're processing multiple BO you may have other validation code
(that catches validation errors from each BO).  The code that creates the
array of objects could be in the Listener.

Does that help?

-Phil


On Tue, 18 Jan 2005 04:03:14 -0400, Sam Clement <[EMAIL PROTECTED]>
wrote:
> I'm looking to create a form that allows a user to cut and paste from 
> an excel file that will then create multiple instances of an object 
> and then add them to the persistence layer.  Am I way off base trying 
> to implement this from the service layer?
> 
> Normally I'd use the bean.cfc, validateFormObject.cfc model but by 
> creating multiple object instances from a single form I'm having 
> difficulty figuring out where I should be putting the validation code 
> and the code that creates the array of objects (to be persisted).  I 
> was thinking of rolling the creation of the array of objects and 
> validation into one function/method within the service layer.  Does 
> that make sense in the context of what I'm trying to do?
> 
> Any insight appreciated.
> 
> Cheers,
> 
> Sam
> ________________________________
> 
> Sam Clement
> ABOVE Studios
> Boutique Design Solutions
> 
> <http://www.abovestudios.com/>
> 32 Clifford St - Belmont
> Trinidad + Tobago - West Indies
> T: (868) 621 5159 W: abovestudios.com
> <http://www.abovestudios.com/>
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to 
> [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, 
> Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to