Personally this is a design by design approach. In some cases, it may make sense to make your beans "clever", and others not. I recommend you evaluate your needs and don't put a hard and fast rule on it. Something I've found myself doing in the past (with Transfer ORM) is creating Data Transfer Objects (which have nothing to do with Transfer ORM) which I would consider the lowest on the food chain as far as intelligence. Reason being is, its very easy to work with when passing data to flex.

In some cases, a bean *may* want to be sorta intelligent, and for the cases where you run into both, the DTO is a nice middle of the road.


On Aug 3, 2007, at 3:55 PM, Alan Livie wrote:

I'm new to OO in Coldfusion and have just began my OO journey.

Thanks to the blogs of Sean Corfield, Joe Rinehart etc and a talk on Coldspring by Mark Drew at a CF conference Scotch On The Rocks a few months ago I decded to throw myself into OO development and so far so good. In a producton enviroment I now use a simple Factory (we're hoping to go with Coldspring soon) which sets up and creates all the objects. I use a 'service' CFC as an API which delegates to DAO's and Gateways for db interation. The DAO takes in Beans and also returns them back to the Service etc.

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


Derek P.
[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/cfcdev@cfczone.org

Reply via email to