RE: [CFCDev] Wanted: OOP Best Practice for CFC's with database interaction

2003-12-09 Thread Barney Boisvert
In his Mach-II dev guide, Sean discusses a very similar organizational scheme. http://livedocs.macromedia.com/wtg/public/machiidevguide/models.html The page has a bunch of Mach-II specific stuff at the top, but the last section ("Database Access Objects") is of particular interest, and even inclu

RE: [CFCDev] Wanted: OOP Best Practice for CFC's with database interaction

2003-12-09 Thread Jim Davis
I'm not sure how correct it is, but I tend to create two objects: 1) A domain object - in your case "employee". This contains all the information that could be needed by a single instance of the domain object. 2) An implementation object for working with the domain object - for example "employee

Re: [CFCDev] do you return an obj or a memento from your manager?

2003-12-09 Thread Gabriel Roffman
> The "ideal" solution is to use a data transfer object (DTO). It's a > lightweight version of your BO, that only has getter methods. It takes a BO > memento upon construction, but provides no way to modify it, so it can be > safely passed to the view components. The downside here is that you ha

RE: [CFCDev] do you return an obj or a memento from your manager?

2003-12-09 Thread Barney Boisvert
Your DTO and BO should be memento compatible. If your BO's getters return instance data directly, and there is no private instance data that doesn't have a getter, then a DTO is extraneous, and you can just use a simple struct. However, that's usually not the case, and if any of your BOs require

RE: [CFCDev] do you return an obj or a memento from your manager?

2003-12-09 Thread Barney Boisvert
Your views should NEVER be calling anything to modify your business object, so it's unneccesary (and generally a bad idea) to send a reference to a BO to the view code. However, sending a memento isn't always good enough either. Say you need to display a some info about a person, including thei

Re: [CFCDev] relationship between objects and managers

2003-12-09 Thread Thomas Chiverton
On Tuesday 09 Dec 2003 14:07 pm, Gabriel Roffman wrote: > SalesGroupManager. It seems like it might be better to have managers talk > to managers. Or to have a broker/exchange that all the managers register with, and use for cross-object calls. -- Tom Chiverton Advanced ColdFusion Programmer

[CFCDev] relationship between objects and managers

2003-12-09 Thread Gabriel Roffman
Is it ok for an object to call a manager that is not its own? For example, lets say that you have a "territory" and the territory has a "sales group". What do you think of having the territory.cfc have a getSalesGroup function that calls SalesGroupManager.getSalesGroup? The other option is to hav

[CFCDev] do you return an obj or a memento from your manager?

2003-12-09 Thread Gabriel Roffman
Do you like to return the whole object or just the structure of its data when you want to display it in a page? I've started using Sean's approach as detailed in the model section of the Mach II development guide. What I have found is that most times I want to display the data of the object, but