My opinion is that a Bean should be able to validate itself to ensure that
it hold valid data. However, it is common for validation to be wrapped up
into another object that the Bean uses (or gets passed into) which actually
does the validation. Especially since a lot of validation code can be reused
across many Beans (using a list of required properties, a list of valid
property values, etc.).

Beans should be clever. I think people view Beans as nothing but data
containers with getters and setters for properties. Technically that is the
definition of a Bean, but a good Business Object can be a Bean (because it
has getters and setters for properties) and still do much more than simply
hold data.

I'm not sure what you mean by "business logic that isn't related to the DB
or the other CFCs".

Hope that helps,

Brian

On 8/3/07, Alan Livie <[EMAIL PROTECTED]> wrote:

> My first question is on bean validation and other business rules that are
> not related to the CFC's I mentioned.
> Some people think validation should be in the bean and other's don't.
> I have my DAO's, Gateways and Service CFC's as 'singletons' (or very
> similair to singletons - cached in the Factory) and the Beans are not
> (because they have 'state')
> If I have complex validation I think it would be better in a seperate CFC
> and the Bean can delegate validation and keep itself simple. Should Beans be
> dumb or clever?
>
> I'd like to hear how other's set up their CFC's and why just to check I'm
> going in the right direction and where I can improve. For example, business
> logic that isn't related to the db or the other CFC's. Does this just go
> into other CFC's or is there certain places this should go?
>
> OO is a tough subject to get to grips with and even after reading as much
> as I can find on the subject I'm still at the crawling stage.
>
> I also use the excellent Illudium code generator to write the basic CFC's.
> I also plan to use Reactor and Model Glue in the future.
>
> I've also just read Peter Bell writing about IBO's so looks like I have
> another 'pattern' to get my head around! I think I'm suffering from 'pattern
> fever'  :-)
>
> Alan
>
>
>
> You are subscribed to cfcdev. To unsubscribe, please follow the
> instructions at http://www.cfczone.org/listserv.cfm
>
> CFCDev is supported by:
> Katapult Media, Inc.
> We are cool code geeks looking for fun projects to rock!
> www.katapultmedia.com
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/cfcdev@cfczone.org
>
>


You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org

Reply via email to