I think you are on the right track but missed the business rules end of OO.
I would do the same as you - create objects for dealing with my underlying tables. I call these objects "data access components", and normally store them in a different folder called data. Now, you have the concept that an event, venue, and a time slot are related. This is a business rule. In this case, I create another object that will implement the business rules. In your case, I might call the new object an Event object, but store it in a different folder or name it differently so that I know it is NOT a data access component. This object would then do any application specific validation, and processing. The tough part with this is that you have to make a choice where your transactions take place - in the database, or in CF (or whatever language you're using). If you opt for placing the transactions in the database (I'd recommend this where possible), then the call to the stored proc should happen within one of your data access components - the business rule component should not be dealing directly with the database, that is not it's role. Conceptually, you might end up with something like this: EVENT Rules - Data Access Components - Event data access component - Venue data access component - Timeslot data access component - Specialized data access component (if needed). - Business functions - Save Event (-which might call individual functions on the member data components) Not sure if this is entirely clear, but hopefully it get's you moving in the right direction... Shawn -----Original Message----- From: Jim Davis [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 1:14 PM To: CF-Talk Subject: OO modeling Hell Sorry - thismay be semi-off topic (but then again it may be semi-on topic - possibly even flat-out on topic!) I'm working on modeling an existing procedural system (first built in CF 4) to CFMX and want to implement "correctly" (as possible) in an OO/CFC framework. I'm doing the static model now and have run into a conceptual problem. Hoping for some opinions. The system is an event planner for a large, single-day festival. Stripping it down to the problem domain we have a database model with three tables: 1) "Events": All the events taking place. 2) "Venue": All the locations that events can take place at. 3) "TimeSlots": All of the tied begin/end times for events. For example "10:00-14:00", "10:00-11:00", "13:00-15:00", etc In the DB this works well. "Events" and "TimeSlots" are joined with "EventsToTimeSlots" (many to many). You can then query easily based on start-time, end-time, or duration. "EventsToTimeSlots" also links to "Venues". This allows an event to occur at any time and each time to be located at a distinct venue. So we may have a dance troupe appearing at 8pm-10pm at the Boston Ballet bulding, then from 11pm-midnight at Boston Common. When converting this to an object model I naturally began by considering "Event", "Venue" and "TimeSlot" as objects. (Right?) My issue is how to deal with the three-part join. I have, for example, an array in each TimeSlot object containing a references to all the events taking place. I can then loop through all the timeslots and collect all the events taking place at any time or of a certain duration. Sorting this kind of return may be a problem, but not (I think) big one. I can also have an array of references in each Venue object to events taking place there. Lastly (I'm guessing) can have a two-dimensional array of TimeSlot and Venue references in each Event linking each timeslot to a venue. Is this the best way to do this? Should I instead some "sub object" that directly represents my join table that contains a reference to an Event, TimeSlot and Venue? Maybe called "Schedule" or something? Or should each TimeSlot object contain a single reference to an Event and Venue and just have a lot of duplicate StartTime/EndTimes? (I don't think I would as it would be more difficult to present the details of a single event.) Does this whole "Timeslot" idea just not fit in OO as well as it does in the relational system? In the end the model I want should allow each event object to quickly get the venue and time for each performance (perhaps that goes without saying) but I also want to be able to easily list "All events at Venue", "All events at TimeSlot" and "All events at StartTime/EndTime". Thanks in adavance, Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137588 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm