Thanks for the reply Brian. I'm on the Reactor list and read all your mail so thanks for taking time out!
When I said "business logic that isn't related to the DB or the other CFCs" I meant the CFC's I mentioned earlier. I agree all business logic should be in CFC's. I agree with your point that Beans should be clever but my only concern was having identical validation functions in x instances where it could all be delegated to a 'singleton' (or something resembling one!). I don't receive many emails on this list so I may send a few over the next few weeks. Just read 'Head First Design Patterns' and it is one of the best books on software development I've read. I tried the Go4 book but I don't think I'm ready for it yet :-) @Derek, thanks for the reply .... I take your point ... and I'll add DTO to the list :-) Alan ________________________________________ From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brian Kotek [EMAIL PROTECTED] Sent: 04 August 2007 00:06 To: [email protected] Subject: Re: [CFCDEV] Factories, Service Layers, Beans, Gateways, DAO's in CF development 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]<mailto:[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<http://www.katapultmedia.com> An archive of the CFCDev list is available at www.mail-archive.com/[email protected]<http://www.mail-archive.com/[email protected]> 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/[email protected] 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/[email protected]
