It's very relevant to the "outside" world. Not to degrade his question into a discussion of semantics, but if you handed me a "user object", I would expect it to model a user. I would not expect it to be able to create, delete, or persist *other* user objects. I wouldn't expect it to be able to persist itself either. If you don't want "outside world" code that creates or persists users to know about DAOs, then that's all the more reason to write a service layer. Your "UserService" would have methods like createUser():User, saveUser(User):void and fetchUserById(id):User, as well as methods like getAllUsers():query. Your "outside" world would need to know how to interact with the UserService, and how to interact with the User objects that it accepts or returns. Having a user object that both models a user AND performs service-style methods is an example of a monolithic object that quickly becomes difficult to maintain (and is not cohesive it all).
I'm sure those currently tearing apart MM's Petmarket app would agree :) >>> [EMAIL PROTECTED] 10/27/05 8:27 AM >>> >why is variables.oUser adding and deleting users well, right or wrong, I dont see why anything that interfaces with the object even needs to know about the concept of a DAO. So, all the code that is referencing oUser needs to know is to ask the factory for an object, and then call the functions on the object. The fact that the user object passes the call on to the persistence layer, be that database, file system, whatever, is irrelevant to the outside world. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of David Ross Sent: 27 October 2005 13:03 To: [email protected] Subject: RE: [CFCDev] Race Conditions when scoped in the Applicationvariable Along those lines, why is variables.oUser adding and deleting users? -Dave >>> [EMAIL PROTECTED] 10/27/05 3:48 AM >>> <cfset Application.userFactory = CreateObject('component',' com.framework.user') /> <cfset Application.userFactory().AddUser(UserObject) /> <cfset Application.userFactory().DeleteUSer(UserObject) /> bit confused by this code. 1) userFactory is not a function. 2) why is the factory performing CRUD operations? the factory should return an instance of the user component? <cfset Application.userFactory = CreateObject('component',' com.framework.userfactory') /> <cfset variables.oUser = application.userFactory.newUser()><!--- return a new instance of the user object ---> <cfset variables.oUser.AddUser(argumentCollection=form) /> <cfset variables.oUser.DeleteUser(User_ID=form.user_id) /> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Andrew Scott Sent: 27 October 2005 06:49 To: [email protected] Subject: [CFCDev] Race Conditions when scoped in the Application variable Ok I am looking at a solution where I am keeping track of certain details that users do on the website. I was looking at creating it in the application scope. But I am unclear on a few things. If I set up the scop in this manner. <cfset Application.userFactory = CreateObject('component',' com.framework.user') /> Now through the code I will make reference to it like such. <cfset Application.userFactory().AddUser(UserObject) /> <cfset Application.userFactory().DeleteUSer(UserObject) /> Now what I am not clear on is the internals of this, for example. The user object has a structured array that contains the information for all users logged into the system, and other tid bits of information. My question is, should I be locking access to variables when setting inside or not? This is where I am a little unclear, I have had a look at the Mach-II framework and it doesn't seem to do this. Except when setting the application.userfactory in the application scope to begin with. Could someone give me a little more run down on this, as well as hopefully clear the process up a little more for me as well. Regards Andrew Scott Analyst Programmer CMS Transport Systems Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9699 7988 - Fax: 03 9699 7976 Quote: A pessimist thinks everybody is as nasty as himself, and hates them for it. - George Bernard Shaw -------------------------------------------------------------------------- ---------------------------- ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm 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' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------- CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm 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' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm 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' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
