Hello, I'm struggling to determine where to represent some business rules in my CFC's. I apologize in advance for the length of my email.
I am building a Survey system, and I am currently designing the components. (I'm planning on implementing this system in Mach-II.) There is a nice hierarchical relationship in the system: each user will have zero or more surveys, each survey will have one or more pages, and each page will have one or more questions. I currently have the following components: SurveyManager.cfc (manages a user's surveys), Survey.cfc (represents a survey, contains Page objects), Page.cfc (represents a page, contains Question objects), and Question.cfc (represents a question). There are some naming dependencies between the objects: survey names should be unique for a given user, survey page names should be unique within a given survey, and survey questions should be unique within a given survey. My concern is: Where do I enforce the uniqueness of names for these objects? Take the example of a user updating the name to an existing Question on a particular Page in a particular Survey. It seems like I have 3 options: 1) Have Question.UpdateInfo() examine other Question objects in the survey to ensure the new question name is unique (But I feel this should be some other object's concern - a Question should not have to know about the Page or Survey it is in) 2) Have the SurveyManager be the interface for all Survey, Page, and Question updates and let it do the checking (but this seems like a lot of duplication of add/delete/update functions because there would have to be a SurveyManger wrapper function for each public function of Survey, Page, and Question e.g. SurveyManager.UpdateQuestionInfo() would be a wrapper for Question.UpdateInfo() ) 3) Have a page that processes an update to a question validate that a question name is unique in a survey before calling Question.UpdateInfo() directly (but then it seems like I am not enforcing my business rules in my model, and I might have to re-write the business rules for uniqueness of question names if I used a different user interface) Any suggestions? Thanks, Jon Gunnip ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
